diff --git a/sample.config.yaml b/sample.config.yaml index 0ba83efd5..64ecb223c 100644 --- a/sample.config.yaml +++ b/sample.config.yaml @@ -123,6 +123,11 @@ http: # Connection to the Redis server. redis: + # Unix sockets can be used + # + # Default: undefined + #socket: /var/run/redis/redis.sock + # Syntax: redis://[db[:password]@]hostname[:port][/db-number] # # Default: redis://localhost:6379/0 diff --git a/src/xo.js b/src/xo.js index 73f4e4e38..375efe193 100644 --- a/src/xo.js +++ b/src/xo.js @@ -44,11 +44,15 @@ export default class Xo extends EventEmitter { this._httpRequestWatchers = createRawObject() // Connects to Redis. - const redisConf = config.redis - this._redis = createRedisClient(redisConf && { - rename_commands: redisConf.renameCommands, - url: redisConf.uri - }) + { + const { + renameCommands: rename_commands, + socket: path, + uri: url + } = config.redis || {} + + this._redis = createRedisClient({ path, rename_commands, url }) + } } // -----------------------------------------------------------------