From d1f4b65c511f8474e0068439ccb23f8e1e7540f5 Mon Sep 17 00:00:00 2001 From: Jari Bakken Date: Thu, 23 Oct 2014 14:39:50 +0200 Subject: [PATCH] Fail fast if DB is not configured --- unleash-server/lib/dbPool.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/unleash-server/lib/dbPool.js b/unleash-server/lib/dbPool.js index 1954866046..f5079dc7be 100644 --- a/unleash-server/lib/dbPool.js +++ b/unleash-server/lib/dbPool.js @@ -6,19 +6,18 @@ var anyDB = require('any-db'), function createDbPool() { - // Use postgres db from DATABASE_URL if set if (process.env.DATABASE_URL) { logger.info('unleash started with DATABASE_URL'); return anyDB.createPool(process.env.DATABASE_URL); - } - - // Finn specific way of delivering env variables - else if(nconf.argv().get('databaseini') !== undefined) { + } else if (nconf.argv().get('databaseini') !== undefined) { + // Finn specific way of delivering env variables var databaseini = nconf.argv().get('databaseini'); logger.info('unleash started with databaseini: ' + databaseini); var config = ini.parse(fs.readFileSync(databaseini, 'utf-8')); return anyDB.createPool(config.DATABASE_URL, {min: 2, max: 20}); } + + throw new Error('please set DATABASE_URL or pass --databaseini'); } module.exports = createDbPool(); \ No newline at end of file