From efb54c43e5432875c15e504e7a0668a33d744a22 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 29 Jul 2012 16:53:41 +0200 Subject: o Validating the DATABASE_URL property before starting. --- routes/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'routes') diff --git a/routes/index.js b/routes/index.js index 30f0f9b..24ddf9f 100644 --- a/routes/index.js +++ b/routes/index.js @@ -4,6 +4,12 @@ var collection_json = require('collection_json') , EmployeeDao = require('../lib/dao.js') , _ = require('underscore'); +var database_url; + +module.exports.setup = function(options) { + database_url = options.database_url; +} + function mapRow(row) { var data = _.map(row, function(value, key) { return {name: key, value: value}; @@ -50,7 +56,7 @@ function pager(req) { } function connect(res, cb) { - pg.connect(process.env.DATABASE_URL, function(err, client) { + pg.connect(database_url, function(err, client) { if(err) { res.send('Unable to connect to PostgreSQL.', {'Content-Type': 'text/plain'}, 500); } -- cgit v1.2.3