diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-07-09 19:44:21 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-07-09 19:44:21 -0400 |
| commit | 45da9f0a677bf6bf387840300b5b6edd16c55089 (patch) | |
| tree | 40fcb6439e29a66336541e16b27389a172cfc5f3 /server/db.js | |
| parent | 91e9ee34e54abbba8376be880c1b133d701e598e (diff) | |
populating database
Diffstat (limited to 'server/db.js')
| -rw-r--r-- | server/db.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/db.js b/server/db.js index a56c163..d921243 100644 --- a/server/db.js +++ b/server/db.js @@ -1,11 +1,17 @@ var Sequelize = require("sequelize"), + config = require("../config.json"), pg = require('pg'); var db = module.exports = {} -var DATABASE_URL = process.env.DATABASE_URL || ('postgres://postgres@localhost/' + config.name) +var DATABASE_URL = process.env.DATABASE_URL || ('postgres://postgres:postgres@localhost:5432/' + config.name) -db.sequelize = new Sequelize(DATABASE_URL, { +var match = DATABASE_URL.match(/postgres:\/\/([^:]+):([^@]+)@([^:]+):(\d+)\/(.+)/) + +db.sequelize = new Sequelize(match[5], match[1], match[2], { dialect: 'postgres', - protocol: null, + protocol: 'postgres', + port: match[4], + host: match[3], + logging: true //false }) |
