diff options
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 }) |
