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

Commit 605391ad by Sascha Depold

Allow coffee support via config file

1 parent 6953605b
Showing with 4 additions and 2 deletions
...@@ -115,6 +115,7 @@ var parseDbUrl = function(urlString) { ...@@ -115,6 +115,7 @@ var parseDbUrl = function(urlString) {
var readConfig = function() { var readConfig = function() {
var config var config
if (program.url) { if (program.url) {
config = parseDbUrl(program.url); config = parseDbUrl(program.url);
} else { } else {
...@@ -125,7 +126,7 @@ var readConfig = function() { ...@@ -125,7 +126,7 @@ var readConfig = function() {
} }
} }
if(typeof config != 'object') { if (typeof config != 'object') {
throw new Error('Config must be an object: ' + relativeConfigFile()); throw new Error('Config must be an object: ' + relativeConfigFile());
} }
...@@ -139,6 +140,7 @@ var readConfig = function() { ...@@ -139,6 +140,7 @@ var readConfig = function() {
console.log('Using environment "' + configuration.environment + '".') console.log('Using environment "' + configuration.environment + '".')
config = config[configuration.environment] config = config[configuration.environment]
} }
return config return config
} }
...@@ -207,7 +209,7 @@ if (program.migrate || program.undo) { ...@@ -207,7 +209,7 @@ if (program.migrate || program.undo) {
var sequelize = new Sequelize(config.database, config.username, config.password, options) var sequelize = new Sequelize(config.database, config.username, config.password, options)
, migratorOptions = { path: configuration.migrationsPath } , migratorOptions = { path: configuration.migrationsPath }
if (program.coffee) { if (program.coffee || config.coffee) {
migratorOptions = _.merge(migratorOptions, { filesFilter: /\.js$|\.coffee$/ }) migratorOptions = _.merge(migratorOptions, { filesFilter: /\.js$|\.coffee$/ })
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!