diff options
Diffstat (limited to '')
-rw-r--r-- | lib/models/index.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/models/index.js b/lib/models/index.js index 3b49d459..d52f5508 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -11,7 +11,12 @@ var logger = require("../logger.js"); var dbconfig = config.db; dbconfig.logging = config.debug ? logger.info : false; -var sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig); + +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 = {}; @@ -34,4 +39,4 @@ Object.keys(db).forEach(function (modelName) { db.sequelize = sequelize; db.Sequelize = Sequelize; -module.exports = db;
\ No newline at end of file +module.exports = db; |