Skip to content

Commit

Permalink
Support specifying password for each node. #182
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Oct 24, 2015
1 parent 978342c commit 522c43c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ This file is a manually maintained list of changes for each release. Feel free t

## Master Branch (Unreleased)

* [Cluster] Support specifying password for each node.
* Add an option for setting connection name. [cgiovanacci](https://github.com/cgiovanacci).
* Switch to the previous db before re-subscribing channels.
* Listen to the "secureConnect" event when connect via TLS. [Jeffrey Jen](https://github.com/jeffjen).
* Improve parser performance.

## v1.9.1 - October 2, 2015

Expand Down
13 changes: 13 additions & 0 deletions lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ Cluster.prototype.createNode = function (port, host) {
host: host || '127.0.0.1',
retryStrategy: null
}, Redis.defaultOptions);

// Fetch password from startupNodes option
var password;
for (var i = 0; i < this.startupNodes.length; i++) {
var node = this.startupNodes[i];
if (node.port === port && node.host === host) {
password = node.password || null;
break;
}
}
if (typeof password !== 'undefined') {
nodeOpt.password = password;
}
var key = nodeOpt.host + ':' + nodeOpt.port;

if (!this.nodes[key]) {
Expand Down

0 comments on commit 522c43c

Please sign in to comment.