Update sequelize init condition

This commit is contained in:
Yukai Huang 2016-12-12 11:12:59 +08:00
parent 74c1da4536
commit 5282bf491e
1 changed files with 4 additions and 5 deletions

View File

@ -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 = {};