This commit is contained in:
barisusakli
2014-10-03 16:31:53 -04:00
parent c37cfe4b3f
commit 5db24fbe68
6 changed files with 66 additions and 5 deletions

View File

@@ -53,7 +53,13 @@
winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message);
process.exit();
}
var connString = 'mongodb://'+ nconf.get('mongo:host') + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database');
var usernamePassword = '';
if (nconf.get('mongo:username') && nconf.get('mongo:password')) {
usernamePassword = nconf.get('mongo:username') + ':' + nconf.get('mongo:password') + '@';
}
var connString = 'mongodb://' + usernamePassword + nconf.get('mongo:host') + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database');
var connOptions = {
server: {
poolSize: nconf.get('mongo:poolSize') || 10