Merge pull request #177 from saschagehlich/js_config

allow database.js config
This commit is contained in:
Anatoliy Chakkaev 2012-12-17 01:30:21 -08:00
commit 3c4fd78014
1 changed files with 8 additions and 1 deletions

View File

@ -27,7 +27,14 @@ module.exports = function init(root) {
var confFile = (root || app.root) + '/config/database';
var config = {};
if (existsSync(confFile + '.json')) {
if (existsSync(confFile + '.js')) {
try {
config = require(confFile + '.js');
} catch (e) {
console.log('Could not load config/database.js');
throw e;
}
} else if (existsSync(confFile + '.json')) {
try {
config = JSON.parse(fs.readFileSync(confFile + '.json', 'utf-8'))[app.set('env')];
} catch (e) {