You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
Save url for later, port_arg might be an object
This commit is contained in:
committed by
Ruben Bridgewater
parent
5d3c8f4759
commit
18924eb240
@@ -23,7 +23,8 @@ module.exports = function createClient (port_arg, host_arg, options) {
|
||||
} else if (typeof port_arg === 'string' || port_arg && port_arg.url) {
|
||||
|
||||
options = utils.clone(port_arg.url ? port_arg : host_arg || options);
|
||||
var parsed = URL.parse(port_arg.url || port_arg, true, true);
|
||||
var url = port_arg.url || port_arg;
|
||||
var parsed = URL.parse(url, true, true);
|
||||
|
||||
// [redis:]//[[user][:password]@][host][:port][/db-number][?db=db-number[&password=bar[&option=value]]]
|
||||
if (parsed.slashes) { // We require slashes
|
||||
@@ -59,7 +60,7 @@ module.exports = function createClient (port_arg, host_arg, options) {
|
||||
} else if (parsed.hostname) {
|
||||
throw new RangeError('The redis url must begin with slashes "//" or contain slashes after the redis protocol');
|
||||
} else {
|
||||
options.path = port_arg;
|
||||
options.path = url;
|
||||
}
|
||||
|
||||
} else if (typeof port_arg === 'object' || port_arg === undefined) {
|
||||
|
Reference in New Issue
Block a user