Allow database.js to export function(compound)

This commit is contained in:
Anatoliy Chakkaev 2013-04-04 22:24:56 +04:00
parent 3a355851b6
commit 029dfb6f3b
1 changed files with 5 additions and 1 deletions

View File

@ -30,7 +30,11 @@ module.exports = function init(root) {
try {
var cf = require(confFile);
if (cf instanceof Array) cf = cf[0];
config = cf[app.set('env')];
if (typeof cs === 'function') {
config = cs(railway);
} else {
config = cf[app.set('env')];
}
} catch (e) {
console.log('Could not load config/database.{js|json|yml}');
throw e;