1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
Files
node-redis/test/lib/config.js
Ruben Bridgewater 2b4ab10305 chore - remove standard and use individual config
Standard is not as up to date and still uses a old eslint version.
Instead, use the airbnb default with a couple of modifications.

All required changes are included.
2017-11-28 21:38:21 -02:00

34 lines
620 B
JavaScript

'use strict'
// helpers for configuring a redis client in
// its various modes, ipV6, ipV4, socket.
const redis = require('../../index')
const config = {
redis,
PORT: 6379,
HOST: {
IPv4: '127.0.0.1',
IPv6: '::1'
},
configureClient(ip, opts) {
const args = []
// Do not manipulate the opts => copy them each time
opts = opts ? JSON.parse(JSON.stringify(opts)) : {}
if (ip.match(/\.sock/)) {
args.push(ip)
} else {
args.push(config.PORT)
args.push(config.HOST[ip])
opts.family = ip
}
args.push(opts)
return args
}
}
module.exports = config