summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYukai Huang2016-12-12 11:12:59 +0800
committerYukai Huang2016-12-12 11:12:59 +0800
commit5282bf491e299e50f65484d987558e7bfc031c4b (patch)
treef886c3c3824e8c54271a787b5fec4ee27e09308d /lib
parent74c1da4536285593f3172f8be6a22ad300f73348 (diff)
Update sequelize init condition
Diffstat (limited to '')
-rw-r--r--lib/models/index.js9
1 files changed, 4 insertions, 5 deletions
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 = {};