From 5282bf491e299e50f65484d987558e7bfc031c4b Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Mon, 12 Dec 2016 11:12:59 +0800 Subject: Update sequelize init condition --- lib/models/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/models/index.js b/lib/models/index.js index 60eedf61..d52f5508 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -12,12 +12,11 @@ var logger = require("../logger.js"); var dbconfig = config.db; dbconfig.logging = config.debug ? logger.info : false; -var sequelize; -if (typeof dbconfig.username === 'undefined' && typeof dbconfig.password === 'undefined') { - sequelize = new Sequelize(dbconfig.database, dbconfig); -} else { +var sequelize = null; +if (dbconfig.hasOwnProperty('username') || dbconfig.hasOwnProperty('password')) sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig); -} +else + sequelize = new Sequelize(dbconfig.database, dbconfig); var db = {}; -- cgit v1.2.3