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

Commit 8b9dcff6 by Brad Harris

require config file to allow for json or js files

1 parent a8ce9570
Showing with 4 additions and 5 deletions
......@@ -77,16 +77,15 @@ var createMigrationsFolder = function(force) {
var readConfig = function() {
var config
try {
config = fs.readFileSync(configuration.configFile)
config = require(configuration.configFile);
} catch(e) {
throw new Error('Error reading "' + relativeConfigFile() + '".')
}
try {
config = JSON.parse(config)
} catch (e) {
throw new Error('Error parsing "' + relativeConfigFile() + '" as JSON.')
if(typeof config != 'object') {
throw new Error('Config must be an object: ' + relativeConfigFile());
}
console.log('Loaded configuration file "' + relativeConfigFile() + '".')
if (config[configuration.environment]) {
console.log('Using environment "' + configuration.environment + '".')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!