From c74107c9727d9a8a0bf5a11584ca14bc69764360 Mon Sep 17 00:00:00 2001 From: Paddy Byers Date: Mon, 19 Oct 2015 17:19:16 +0100 Subject: [PATCH] Add mention of tls option --- README.md | 2 ++ index.js | 3 +-- test/lib/stunnel-process.js | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 243942683b..5e04e777e4 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,8 @@ limits total amount of connection tries. Setting this to 1 will prevent any reco * `family`: *IPv4*; You can force using IPv6 if you set the family to 'IPv6'. See Node.js [net](https://nodejs.org/api/net.html) or [dns](https://nodejs.org/api/dns.html) modules how to use the family type. * `disable_resubscribing`: *false*; If set to `true`, a client won't resubscribe after disconnecting * `rename_commands`: *null*; pass a object with renamed commands to use those instead of the original functions. See the [redis security topics](http://redis.io/topics/security) for more info. +* `tls`: an object containing options to pass to [tls.connect](http://nodejs.org/api/tls.html#tls_tls_connect_port_host_options_callback), +to set up a TLS connection to Redis (if, for example, it is set up to be accessible via a tunnel). ```js var redis = require("redis"), diff --git a/index.js b/index.js index 0cd1cd39cc..65909eb16e 100644 --- a/index.js +++ b/index.js @@ -36,13 +36,12 @@ function RedisClient (options) { // Copy the options so they are not mutated options = clone(options); events.EventEmitter.call(this); - var self = this; var cnx_options = {}; if (options.path) { cnx_options.path = options.path; this.address = options.path; } else { - cnx_options.port = options.port || default_port; + cnx_options.port = +options.port || default_port; cnx_options.host = options.host || default_host; cnx_options.family = (!options.family && net.isIP(cnx_options.host)) || (options.family === 'IPv6' ? 6 : 4); this.address = cnx_options.host + ':' + cnx_options.port; diff --git a/test/lib/stunnel-process.js b/test/lib/stunnel-process.js index 7318d3f0fa..a28c7f4de5 100644 --- a/test/lib/stunnel-process.js +++ b/test/lib/stunnel-process.js @@ -62,9 +62,9 @@ StunnelProcess.prototype.clear = function() { }; StunnelProcess.prototype.stop = function(done) { - if(this.stunnel) { - this.stunnel.kill(); - } + if (this.stunnel) { + this.stunnel.kill(); + } }; module.exports = {