You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
Move utility functions in lib/utils.js Improve the js parser in cases the buffer is incomplete Rename lib/parser to lib/parsers Fix smaller issues with test suite and fix parser errors not being catched Fixed wrong test for the new .end flush parameter Fixed test suite options being partly mutated Add some more tests
35 lines
758 B
JavaScript
35 lines
758 B
JavaScript
'use strict';
|
|
|
|
// helpers for configuring a redis client in
|
|
// its various modes, ipV6, ipV4, socket.
|
|
var redis = require('../../index');
|
|
|
|
var config = {
|
|
redis: redis,
|
|
PORT: 6379,
|
|
HOST: {
|
|
IPv4: "127.0.0.1",
|
|
IPv6: "::1"
|
|
},
|
|
configureClient: function (parser, ip, opts) {
|
|
var 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;
|
|
}
|
|
|
|
opts.parser = parser;
|
|
args.push(opts);
|
|
|
|
return args;
|
|
}
|
|
};
|
|
|
|
module.exports = config;
|