不要怂,就是干,撸起袖子干!

Commit 13f24056 by Gavri Fernandez

Migrations now understand NODE_ENV

config.json can now include nested objects for environments keyed by the name
of the environment. If NODE_ENV is not set, it works like it used to.
1 parent e4ee7026
Showing with 12 additions and 2 deletions
......@@ -51,7 +51,11 @@ var createMigrationsFolder = function(force) {
var readConfig = function() {
try {
return JSON.parse(fs.readFileSync(configFile))
var config = JSON.parse(fs.readFileSync(configFile))
if (config[process.env.NODE_ENV]) {
config = config[process.env.NODE_ENV]
}
return config
} catch(e) {
throw new Error('The config.json is not available or contains invalid JSON.')
}
......@@ -105,7 +109,13 @@ if(program.migrate) {
username: "root",
password: null,
database: 'database',
host: '127.0.0.1'
host: '127.0.0.1',
development: {
username: "root",
password: null,
database: 'database',
host: '127.0.0.1'
}
})
console.log('Successfully created config.json')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!