mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
don't attempt to initialize db until we attempt to initialize
This commit is contained in:
@@ -21,16 +21,24 @@
|
|||||||
connectLevel,
|
connectLevel,
|
||||||
db;
|
db;
|
||||||
|
|
||||||
try {
|
module.questions = [
|
||||||
levelup = require('levelup');
|
{
|
||||||
leveldown = require('leveldown');
|
name: "level:database",
|
||||||
connectLevel = require('connect-leveldb')(express);
|
description: "Enter the path to your Level database",
|
||||||
} catch (err) {
|
'default': nconf.get('level:database') || '/var/level/nodebb'
|
||||||
winston.error('Unable to initialize Level DB! Is Level DB installed? Error :' + err.message);
|
}
|
||||||
process.exit();
|
];
|
||||||
}
|
|
||||||
|
|
||||||
module.init = function(callback) {
|
module.init = function(callback) {
|
||||||
|
try {
|
||||||
|
levelup = require('levelup');
|
||||||
|
leveldown = require('leveldown');
|
||||||
|
connectLevel = require('connect-leveldb')(express);
|
||||||
|
} catch (err) {
|
||||||
|
winston.error('Unable to initialize Level DB! Is Level DB installed? Error :' + err.message);
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
if (db) {
|
if (db) {
|
||||||
if(typeof callback === 'function') {
|
if(typeof callback === 'function') {
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -11,16 +11,41 @@
|
|||||||
mongoClient,
|
mongoClient,
|
||||||
mongoStore;
|
mongoStore;
|
||||||
|
|
||||||
try {
|
module.questions = [
|
||||||
mongoClient = require('mongodb').MongoClient;
|
{
|
||||||
mongoStore = require('connect-mongo')(express);
|
name: 'mongo:host',
|
||||||
} catch (err) {
|
description: 'Host IP or address of your MongoDB instance',
|
||||||
winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message);
|
'default': nconf.get('mongo:host') || '127.0.0.1'
|
||||||
process.exit();
|
},
|
||||||
}
|
{
|
||||||
|
name: 'mongo:port',
|
||||||
|
description: 'Host port of your MongoDB instance',
|
||||||
|
'default': nconf.get('mongo:port') || 27017
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'mongo:username',
|
||||||
|
description: 'MongoDB username'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'mongo:password',
|
||||||
|
description: 'Password of your MongoDB database'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "mongo:database",
|
||||||
|
description: "Which database to use",
|
||||||
|
'default': nconf.get('mongo:database') || 0
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
module.init = function(callback) {
|
module.init = function(callback) {
|
||||||
|
try {
|
||||||
|
mongoClient = require('mongodb').MongoClient;
|
||||||
|
mongoStore = require('connect-mongo')(express);
|
||||||
|
} catch (err) {
|
||||||
|
winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message);
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
mongoClient.connect('mongodb://'+ nconf.get('mongo:host') + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, _db) {
|
mongoClient.connect('mongodb://'+ nconf.get('mongo:host') + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), 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);
|
||||||
|
|||||||
@@ -15,16 +15,38 @@
|
|||||||
postSearch,
|
postSearch,
|
||||||
topicSearch;
|
topicSearch;
|
||||||
|
|
||||||
try {
|
module.questions = [
|
||||||
redis = require('redis');
|
{
|
||||||
connectRedis = require('connect-redis')(express);
|
name: 'redis:host',
|
||||||
reds = require('reds');
|
description: 'Host IP or address of your Redis instance',
|
||||||
} catch (err) {
|
'default': nconf.get('redis:host') || '127.0.0.1'
|
||||||
winston.error('Unable to initialize Redis! Is Redis installed? Error :' + err.message);
|
},
|
||||||
process.exit();
|
{
|
||||||
}
|
name: 'redis:port',
|
||||||
|
description: 'Host port of your Redis instance',
|
||||||
|
'default': nconf.get('redis:port') || 6379
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'redis:password',
|
||||||
|
description: 'Password of your Redis database'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "redis:database",
|
||||||
|
description: "Which database to use (0..n)",
|
||||||
|
'default': nconf.get('redis:database') || 0
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
module.init = function(callback) {
|
module.init = function(callback) {
|
||||||
|
try {
|
||||||
|
redis = require('redis');
|
||||||
|
connectRedis = require('connect-redis')(express);
|
||||||
|
reds = require('reds');
|
||||||
|
} catch (err) {
|
||||||
|
winston.error('Unable to initialize Redis! Is Redis installed? Error :' + err.message);
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
if (redis_socket_or_host && redis_socket_or_host.indexOf('/')>=0) {
|
if (redis_socket_or_host && redis_socket_or_host.indexOf('/')>=0) {
|
||||||
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
||||||
redisClient = redis.createClient(nconf.get('redis:host'));
|
redisClient = redis.createClient(nconf.get('redis:host'));
|
||||||
|
|||||||
Reference in New Issue
Block a user