mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 19:21:04 +01:00
Merge pull request #3156 from pentode/master
add feature to define mongo client connect options via config.json
This commit is contained in:
@@ -70,6 +70,7 @@
|
|||||||
"touch": "0.0.3",
|
"touch": "0.0.3",
|
||||||
"uglify-js": "git+https://github.com/julianlam/UglifyJS2.git",
|
"uglify-js": "git+https://github.com/julianlam/UglifyJS2.git",
|
||||||
"underscore": "~1.8.3",
|
"underscore": "~1.8.3",
|
||||||
|
"underscore.deep": "^0.5.1",
|
||||||
"validator": "^3.30.0",
|
"validator": "^3.30.0",
|
||||||
"winston": "^0.9.0",
|
"winston": "^0.9.0",
|
||||||
"xregexp": "~2.0.0"
|
"xregexp": "~2.0.0"
|
||||||
|
|||||||
@@ -7,8 +7,11 @@
|
|||||||
async = require('async'),
|
async = require('async'),
|
||||||
nconf = require('nconf'),
|
nconf = require('nconf'),
|
||||||
session = require('express-session'),
|
session = require('express-session'),
|
||||||
|
_ = require('underscore'),
|
||||||
db, mongoClient;
|
db, mongoClient;
|
||||||
|
|
||||||
|
_.mixin(require('underscore.deep'));
|
||||||
|
|
||||||
module.questions = [
|
module.questions = [
|
||||||
{
|
{
|
||||||
name: 'mongo:host',
|
name: 'mongo:host',
|
||||||
@@ -88,6 +91,9 @@
|
|||||||
poolSize: parseInt(nconf.get('mongo:poolSize'), 10) || 10
|
poolSize: parseInt(nconf.get('mongo:poolSize'), 10) || 10
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
connOptions = _.deepExtend((nconf.get('mongo:options') || {}), connOptions);
|
||||||
|
|
||||||
mongoClient.connect(connString, connOptions, function(err, _db) {
|
mongoClient.connect(connString, connOptions, function(err, _db) {
|
||||||
if (err) {
|
if (err) {
|
||||||
winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + err.message);
|
winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + err.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user