feat(Redis): support aliased commands

Fixes #443
This commit is contained in:
Julien Fontanet 2016-11-08 10:23:53 +01:00
parent 8bedb1f3b9
commit b99b4159c8
3 changed files with 17 additions and 5 deletions

View File

@ -123,10 +123,18 @@ http:
# Connection to the Redis server.
redis:
# Syntax: redis://[db[:password]@]hostname[:port]
# Syntax: redis://[db[:password]@]hostname[:port][/db-number]
#
# Default: redis://localhost:6379
#uri: ''
# Default: redis://localhost:6379/0
#uri: redis://redis.company.lan/42
# List of aliased commands.
#
# See http://redis.io/topics/security#disabling-of-specific-commands
#renameCommands:
# del: '3dda29ad-3015-44f9-b13b-fa570de92489'
# srem: '3fd758c9-5610-4e9d-a058-dbf4cb6d8bf0'
# Directory containing the database of XO.
# Currently used for logs.

View File

@ -36,7 +36,7 @@ export default class Redis extends Collection {
connection,
indexes = [],
prefix,
uri = 'tcp://localhost:6379'
uri
}) {
super()

View File

@ -41,7 +41,11 @@ export default class Xo extends EventEmitter {
this._httpRequestWatchers = createRawObject()
// Connects to Redis.
this._redis = createRedisClient(config.redis && config.redis.uri)
const redisConf = config.redis
this._redis = createRedisClient(redisConf && {
rename_commands: redisConf.renameCommands,
url: redisConf.uri
})
}
// -----------------------------------------------------------------