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

Commit 9f1eacd2 by Sascha Depold

Merge pull request #284 from gavri/migration-environments

Migrations now understand NODE_ENV
2 parents 01934f75 13f24056
Showing with 12 additions and 2 deletions
...@@ -51,7 +51,11 @@ var createMigrationsFolder = function(force) { ...@@ -51,7 +51,11 @@ var createMigrationsFolder = function(force) {
var readConfig = function() { var readConfig = function() {
try { 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) { } catch(e) {
throw new Error('The config.json is not available or contains invalid JSON.') throw new Error('The config.json is not available or contains invalid JSON.')
} }
...@@ -105,7 +109,13 @@ if(program.migrate) { ...@@ -105,7 +109,13 @@ if(program.migrate) {
username: "root", username: "root",
password: null, password: null,
database: 'database', 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') 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!