From 252a067df74edc417a2079661d9b950a4469aa54 Mon Sep 17 00:00:00 2001 From: Sascha Gehlich Date: Mon, 17 Dec 2012 10:25:27 +0100 Subject: [PATCH] allow database.js config --- lib/railway.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/railway.js b/lib/railway.js index bc54a920..e6bfaa71 100644 --- a/lib/railway.js +++ b/lib/railway.js @@ -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) {