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

Config options are not passed to Sequelize() when use_env_variable is set #584

Closed
jjulian opened this issue Nov 10, 2017 · 0 comments
Closed

Comments

@jjulian
Copy link
Contributor

jjulian commented Nov 10, 2017

What you are doing?

I want to turn logging off in production, and I am using a connection string from an env var:

  "production": {
    "use_env_variable": "RDS_CONNECTION_URL",
    "dialect": "postgres",
    "logging": false
  }

Logging will not get turned off, since this config options object is not passed to the Sequelize() initializer in the default skeleton models/index.js:

if (config.use_env_variable) {
  var sequelize = new Sequelize(process.env[config.use_env_variable]);
} else {
  var sequelize = new Sequelize(config.database, config.username, config.password, config);
}

I had to edit my models/index.js file to init like this:

if (config.use_env_variable) {
  var sequelize = new Sequelize(process.env[config.use_env_variable], config);
} else {
  var sequelize = new Sequelize(config.database, config.username, config.password, config);
}

What do you expect to happen?

Config options should be respected when using an env var connection string

What is actually happening?

All config options other than use_env_variable are ignored

PR forthcoming

codetriage-readme-bot pushed a commit to codetriage-readme-bot/cli that referenced this issue Jun 5, 2019
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

No branches or pull requests

1 participant