Skip to content
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

Improved database defaults #579

Merged
merged 1 commit into from
Nov 2, 2017

Conversation

dijonkitchen
Copy link
Contributor

@dijonkitchen dijonkitchen commented Oct 25, 2017

Uses process.env variables to control config for production (as documented).

Details in commits.

@@ -69,22 +69,22 @@ const api = {
development: {
username: 'root',
password: null,
database: 'database_development',
database: `${process.env.PWD.split('/').pop()}_development`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this change

host: '127.0.0.1',
dialect: 'mysql'
},
test: {
username: 'root',
password: null,
database: 'database_test',
database: `${process.env.PWD.split('/').pop()}_test`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this one as well

Copy link
Contributor

@sushantdhiman sushantdhiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your idea for using environment variables in config by default, but I think we should make that change for production only

@sushantdhiman sushantdhiman merged commit 006c4ec into sequelize:master Nov 2, 2017
@dijonkitchen dijonkitchen deleted the db-defaults branch November 3, 2017 04:03
dijonkitchen added a commit to dijonkitchen/sequelize that referenced this pull request Nov 23, 2017
@sushantdhiman
Copy link
Contributor

Should have added tests, this config actually doesnt works. Default config is missing "production" keys which use env variable

@dijonkitchen
Copy link
Contributor Author

Should there be tests for a production environment? I figure that'd be abstracted away by server environment variables per 12factor principles.

@sushantdhiman
Copy link
Contributor

Issue is if those env variable are not defined, config.json will not include those keys. We should definitely have tests if correct default config is generated, i.e. env defaults are actually added in config file rather than empty / non existing keys

@sushantdhiman
Copy link
Contributor

I am reverting this change, documentation should specify safe defaults, beside having env var inside json is not good either. There is a proper way of doing that as explained in http://docs.sequelizejs.com/manual/tutorial/migrations.html#using-environment-variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants