|
|
@ -4,7 +4,15 @@
|
|
|
|
winston = require('winston'),
|
|
|
|
winston = require('winston'),
|
|
|
|
nconf = require('nconf');
|
|
|
|
nconf = require('nconf');
|
|
|
|
|
|
|
|
|
|
|
|
RedisDB.exports = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host'));
|
|
|
|
var redis_socket_or_host = nconf.get('redis:host')
|
|
|
|
|
|
|
|
if(redis_socket_or_host.indexOf('/')>=0) {
|
|
|
|
|
|
|
|
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
|
|
|
|
|
|
|
RedisDB.exports = redis.createClient(nconf.get('redis:host'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
/* Else, connect over tcp/ip */
|
|
|
|
|
|
|
|
RedisDB.exports = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (nconf.get('redis:password')) {
|
|
|
|
if (nconf.get('redis:password')) {
|
|
|
|
RedisDB.exports.auth(nconf.get('redis:password'));
|
|
|
|
RedisDB.exports.auth(nconf.get('redis:password'));
|
|
|
@ -55,4 +63,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}(module));
|
|
|
|
}(module));
|
|
|
|