From acaeef172a96f613704a08c5fdc0d192be9eab31 Mon Sep 17 00:00:00 2001 From: bananaappletw Date: Thu, 22 Dec 2016 13:23:17 +0800 Subject: [PATCH] Fix #293 --- lib/models/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/models/index.js b/lib/models/index.js index d52f550..1156d0f 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 = {};