From 90f5683cc29fc3af6c249014c17cc451b5149885 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 22 Apr 2014 01:39:57 -0400 Subject: [PATCH] read redis host just before connecting --- src/database/redis.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/database/redis.js b/src/database/redis.js index 917dd01d19..ea73f929bb 100644 --- a/src/database/redis.js +++ b/src/database/redis.js @@ -6,7 +6,6 @@ nconf = require('nconf'), path = require('path'), express = require('express'), - redis_socket_or_host = nconf.get('redis:host'), utils = require('./../../public/src/utils.js'), redis, connectRedis, @@ -48,6 +47,8 @@ process.exit(); } + var redis_socket_or_host = nconf.get('redis:host'); + 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 */ redisClient = redis.createClient(nconf.get('redis:host')); @@ -106,7 +107,7 @@ module.close = function() { redisClient.quit(); }; - + module.helpers = module.helpers || {}; module.helpers.redis = require('./redis/helpers'); }(exports));