added authentication to mongo

v1.18.x
Baris Usakli 11 years ago
parent f861d44d55
commit 351b07bb34

@ -28,10 +28,14 @@
// TODO : what is the db user name?? // TODO : what is the db user name??
/*if(nconf.get('mongo:password')) { if(nconf.get('mongo:password') && nconf.get('mongo:username')) {
db.authenticate(dbUser, nconf.get('mongo:password'), function (err) { db.authenticate(nconf.get('mongo:username'), nconf.get('mongo:password'), function (err) {
if(err) {
winston.error(err.message);
}
process.exit();
}); });
}*/ }
db.createCollection('objects', function(err, collection) { db.createCollection('objects', function(err, collection) {
@ -60,7 +64,7 @@
} }
}); });
} }
}) });
callback(err); callback(err);
}); });

@ -64,6 +64,9 @@ var async = require('async'),
name: 'mongo:port', name: 'mongo:port',
description: 'Host port of your MongoDB instance', description: 'Host port of your MongoDB instance',
'default': nconf.get('mongo:port') || 27017 'default': nconf.get('mongo:port') || 27017
}, {
name: 'mongo:user',
description: 'MongoDB username'
}, { }, {
name: 'mongo:password', name: 'mongo:password',
description: 'Password of your MongoDB database' description: 'Password of your MongoDB database'

Loading…
Cancel
Save