Merge pull request #177 from saschagehlich/js_config
allow database.js config
This commit is contained in:
commit
3c4fd78014
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue