Skip to content

Commit

Permalink
Add authorization for redis in init.js (s-nomp#27)
Browse files Browse the repository at this point in the history
This adds missing authentication for redis connection initialization in init.js.
  • Loading branch information
Punkoivan authored and egyptianbman committed Aug 3, 2018
1 parent b8f4c01 commit 352bf19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@

"redis": {
"host": "127.0.0.1",
"port": 6379
"port": 6379,
"password": ""
},

"switching": {
Expand Down
6 changes: 6 additions & 0 deletions init.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ var spawnPoolWorkers = function(){
} else if (!connection) {
redisConfig = pcfg.redis;
connection = redis.createClient(redisConfig.port, redisConfig.host);
if (redisConfig.password != "") {
connection.auth(redisConfig.password);
connection.on("error", function (err) {
logger.error("redis", coin, "An error occured while attempting to authenticate redis: " + err);
});
}
connection.on('ready', function(){
logger.debug('PPLNT', coin, 'TimeShare processing setup with redis (' + redisConfig.host +
':' + redisConfig.port + ')');
Expand Down

0 comments on commit 352bf19

Please sign in to comment.