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