Browse Source

Save url for later, port_arg might be an object

gracefull-invalid-url
Luke Childs 7 years ago
parent
commit
2f90c23a53
  1. 5
      lib/createClient.js

5
lib/createClient.js

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

Loading…
Cancel
Save