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

Commit b8e584d7 by Sascha Depold

added config for production/development/test and use development config by default

1 parent 9f1eacd2
Showing with 18 additions and 7 deletions
......@@ -52,9 +52,12 @@ var createMigrationsFolder = function(force) {
var readConfig = function() {
try {
var config = JSON.parse(fs.readFileSync(configFile))
if (config[process.env.NODE_ENV]) {
config = config[process.env.NODE_ENV]
, env = process.env.NODE_ENV || 'development'
if (config[env]) {
config = config[env]
}
return config
} catch(e) {
throw new Error('The config.json is not available or contains invalid JSON.')
......@@ -106,14 +109,22 @@ if(program.migrate) {
} else if(program.init) {
if(!configFileExists || !!program.force) {
writeConfig({
username: "root",
password: null,
database: 'database',
host: '127.0.0.1',
development: {
username: "root",
password: null,
database: 'database',
database: 'database_development',
host: '127.0.0.1'
},
test: {
username: "root",
password: null,
database: 'database_test',
host: '127.0.0.1'
},
production: {
username: "root",
password: null,
database: 'database_production',
host: '127.0.0.1'
}
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!