feat(redis): can connect via Unix socket

Fixes vatesfr/xo-web#1944
This commit is contained in:
Julien Fontanet
2017-02-16 11:32:35 +01:00
parent 261587511b
commit b989d157a0
2 changed files with 14 additions and 5 deletions

View File

@@ -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

View File

@@ -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 })
}
}
// -----------------------------------------------------------------