some mongo stuff

v1.18.x
Baris Soner Usakli 11 years ago
parent d4eddc6e2c
commit 304285e874

@ -2,31 +2,35 @@
(function(module) { (function(module) {
'use strict'; 'use strict';
var mongoClient, var mongodb = require('mongodb')
mongo = require('mongo') mongoClient = mongodb.MongoClient,
winston = require('winston'), winston = require('winston'),
nconf = require('nconf'), nconf = require('nconf'),
mongoHost = nconf.get('mongo:host'), express = require('express'),
utils = require('./../../public/src/utils.js'); mongoStore = require('connect-mongo')(express);
mongoHost = nconf.get('mongo:host');
// temp, look this up
mongoClient = mongo.createClient(nconf.get('mongo:port'), nconf.get('mongo:host')); // mongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
mongoClient.connect('mongodb://' + mongoHost + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, db) {
if(err) {
winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + error.message);
process.exit();
}
});
// look up how its done in mongo // look up how its done in mongo
/*if (nconf.get('mongo:password')) { /*if (nconf.get('mongo:password')) {
redisClient.auth(nconf.get('mongo:password')); redisClient.auth(nconf.get('mongo:password'));
} }
*/
var db = parseInt(nconf.get('mongo:database'), 10); // TODO: fill out settings.db
module.sessionStore = new mongoStore({
if (db){ db: settings.db
mongoClient.select(db, function(error) {
if(error) {
winston.error("NodeBB could not connect to your Redis database. Redis returned the following error: " + error.message);
process.exit();
}
}); });
}*/
// //
// Exported functions // Exported functions

Loading…
Cancel
Save