Permalink
Browse files

added redis socket support

In order to enable socket support I added another command line argument: `--sock` which can be true or false.
If set to true the script will try to connect via sockets to the redis host provided via the `--redis` flag. In
that case the port will be omitted.
  • Loading branch information...
1 parent ac5d254 commit f6fa7d281aab62b1ca23a25d8cfc36785a562797 ivrrecht committed with pguth Dec 1, 2015
Showing with 8 additions and 2 deletions.
  1. +1 −0 config.js
  2. +7 −2 lib/data/redis.js
View
@@ -22,6 +22,7 @@ exports.googleanalytics = {
var redis_conf = argv.redis || '127.0.0.1:6379';
exports.database = {
+ sock: argv['sock'] || false,
type: 'redis',
prefix: '#scrumblr#',
host: redis_conf.split(':')[0] || '127.0.0.1',
View
@@ -16,8 +16,13 @@ var REDIS_PREFIX = '#scrumblr#';
var db = function(callback) {
- console.log('Opening redis connection to ' + conf.host + ':' + conf.port);
- redisClient = redis.createClient(conf.port, conf.host, {});
+ if (conf.sock) {
+ console.log('Opening redis connection to socket ' + conf.host);
+ redisClient = redis.createClient(conf.host);
+ } else {
+ console.log('Opening redis connection to ' + conf.host + ':' + conf.port);
+ redisClient = redis.createClient(conf.port, conf.host, {});
+ }
redisClient.on("connect", function (err) {
callback();
});

0 comments on commit f6fa7d2

Please sign in to comment.