merging in Peter Cellik's changes to allow NodeBB to work with a passworded Redis store. Fixes #11

v1.18.x
Julian Lam 12 years ago
parent 0d954b24dc
commit d0e5938788

@ -110,6 +110,7 @@ fs.readFile(path.join(__dirname, 'config.json'), function(err, data) {
ask('Will you be using a port number to access NodeBB? (y)', function(use_port) { ask('Will you be using a port number to access NodeBB? (y)', function(use_port) {
ask('... the host IP or address of your Redis instance? (127.0.0.1)', function(redis_host) { ask('... the host IP or address of your Redis instance? (127.0.0.1)', function(redis_host) {
ask('... the host port of your Redis instance? (6379)', function(redis_port) { ask('... the host port of your Redis instance? (6379)', function(redis_port) {
ask('... the password of your Redis database? (no password)', function(redis_password) {
ask('... your NodeBB secret? (keyboard mash for a bit here)', function(secret) { ask('... your NodeBB secret? (keyboard mash for a bit here)', function(secret) {
if (!base_url) base_url = 'http://localhost'; if (!base_url) base_url = 'http://localhost';
if (!port) port = 4567; if (!port) port = 4567;
@ -128,7 +129,8 @@ fs.readFile(path.join(__dirname, 'config.json'), function(err, data) {
upload_path: '/public/uploads/', upload_path: '/public/uploads/',
redis: { redis: {
host: redis_host, host: redis_host,
port: redis_port port: redis_port,
password: redis_password
} }
} }
@ -166,5 +168,6 @@ fs.readFile(path.join(__dirname, 'config.json'), function(err, data) {
}); });
}); });
}); });
});
} }
}); });

@ -7,6 +7,10 @@
RedisDB.exports = redis.createClient(global.config.redis.port, global.config.redis.host); RedisDB.exports = redis.createClient(global.config.redis.port, global.config.redis.host);
if( global.config.redis.password ) {
RedisDB.exports.auth(global.config.redis.password);
}
RedisDB.exports.handle = function(error) { RedisDB.exports.handle = function(error) {
if (error !== null) { if (error !== null) {
if (PRODUCTION === false) { if (PRODUCTION === false) {

Loading…
Cancel
Save