title: nodejs sequelize/cli how to use with node-config
body: <p>First off it's my first time with Sequelize so be patient.</p>
  
  <p>I'd like  to use <a href="https://github.com/sequelize/cli" rel="nofollow">https://github.com/sequelize/cli</a>
  along with <a href="https://github.com/lorenwest/node-config" rel="nofollow">https://github.com/lorenwest/node-config</a></p>
  
  <p>I want sequelize to be able to "compose" it's configuration from multiple source files, the same manner that node-config does.</p>
  
  <p>By now I've worked it out with</p>
  
  <h2>.sequelizerc</h2>
  
  <pre><code>var path = require('path')
  var Config = require('config');
  var env =Config.util.getEnv('NODE_ENV');
  module.exports = {
    'config':          path.resolve('config', env + '.json')
  }
  </code></pre>
  
  <h2>development.json ie</h2>
  
  <pre><code>{
      "app": {
          "name": "my api"
      },
      "server": {
          "port": 8081
      },
      "development": {
              "username": "username",
              "password": "password",
              "database": "database",
              "host": "127.0.0.1",
              "dialect": "mysql"
      }
  } 
  </code></pre>
  
  <p>You can see i have to set a redundant env key
  with no logical meaning
  in all my env.json files.</p>
  
  <p>is there a better way ?</p>
  
  <h2>drawback</h2>
  
  <p>To get the data:</p>
  
  <pre><code>var env =Config.util.getEnv('NODE_ENV');
  var configDb = Config.get(env);
  </code></pre>
  
  <p>and this way all the options of 
  File Load Order are lost.</p>
  
  <p><a href="https://github.com/lorenwest/node-config/wiki/Configuration-Files" rel="nofollow">https://github.com/lorenwest/node-config/wiki/Configuration-Files</a></p>
  
  <h2>Other way</h2>
  
  <pre><code>sequelize db:migrate --url 'mysql://root:password@mysql_host.com/database_name'
  </code></pre>
  
  <p>with the standard node-config json files.</p>