-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add connection string initialization #73
Comments
+1 But, now I am using "parse-database-url". import * as parseDbUrl from "parse-database-url";
---
let dbConfig = parseDbUrl(process.env["DATABASE_URL"]);
const sequelize = new Sequelize({
name: dbConfig.database,
username: dbConfig.user,
password: dbConfig.password,
dialect: dbConfig.driver,
host: dbConfig.host,
port: dbConfig.port,
modelPaths: [__dirname + '/../main/models']
}); |
Winning! I'll take that all day. Personal preference for simple stuff like that which is only a few LOC i'm dependency averse. At the same time, whatever works ;) |
@aventurella thanks for raising this. I will consider this for the next releases. But if you're like to create a PR for that, feel free to do so. Any help is appreciated :) |
@RobinBuschmann I've recently tried implementing it using static factory function, without parser dependency. But then I realized that it breaks backward compatibility because I had to remove the constructor. |
Hey @kukoo1, can you show me how your approach looks like? Thank you |
Per the docs:
http://docs.sequelizejs.com/manual/installation/getting-started.html#setting-up-a-connection
This should be allowed to be passed into the
Sequelize
constructor:https://github.com/sequelize/sequelize/blob/master/lib/sequelize.js#L103-L134
This appears to work (I ported from their code):
The text was updated successfully, but these errors were encountered: