diff options
author | bananaappletw | 2016-12-22 13:23:17 +0800 |
---|---|---|
committer | bananaappletw | 2016-12-22 13:23:17 +0800 |
commit | acaeef172a96f613704a08c5fdc0d192be9eab31 (patch) | |
tree | 5846349bca15ec0dd3f4a39d356ebf768a3e1467 /lib | |
parent | 8153fa32ed963f3c8b122dd673bb3ab64323e2ab (diff) |
Fix #293
Diffstat (limited to 'lib')
-rw-r--r-- | lib/models/index.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/models/index.js b/lib/models/index.js index d52f5508..1156d0f7 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -13,10 +13,11 @@ var dbconfig = config.db; dbconfig.logging = config.debug ? logger.info : false; var sequelize = null; -if (dbconfig.hasOwnProperty('username') || dbconfig.hasOwnProperty('password')) - sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig); + +if (process.env.DATABASE_URL) + sequelize = new Sequelize(process.env.DATABASE_URL, dbconfig.username, dbconfig.password, dbconfig); else - sequelize = new Sequelize(dbconfig.database, dbconfig); + sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig); var db = {}; |