diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-07-29 16:53:41 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-07-29 16:53:41 +0200 |
commit | efb54c43e5432875c15e504e7a0668a33d744a22 (patch) | |
tree | 3ce3148f8c898d1724e0419544ee9674ca0b53dc /routes | |
parent | ae9f6a1c13938735494a93d29deab2f2a92f0ab3 (diff) | |
download | example-collection-json-db-efb54c43e5432875c15e504e7a0668a33d744a22.tar.gz example-collection-json-db-efb54c43e5432875c15e504e7a0668a33d744a22.tar.bz2 example-collection-json-db-efb54c43e5432875c15e504e7a0668a33d744a22.tar.xz example-collection-json-db-efb54c43e5432875c15e504e7a0668a33d744a22.zip |
o Validating the DATABASE_URL property before starting.
Diffstat (limited to 'routes')
-rw-r--r-- | routes/index.js | 8 |
1 files changed, 7 insertions, 1 deletions
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); } |