From f21b808058f8440b26e1bfafec7d31864e0a65b0 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 31 Jul 2017 00:04:58 -0700 Subject: [PATCH 1/3] copy opts into pubsub config --- index.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 4a085b5..7584813 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,10 @@ exports.load_redis_ini = function () { if (!ps.host) ps.host = s.host; if (!ps.port) ps.port = s.port; - if (!plugin.redisCfg.opts) plugin.redisCfg.opts = {}; + if (plugin.redisCfg.opts === undefined) plugin.redisCfg.opts = {}; + Object.keys(plugin.redisCfg.opts).forEach(opt => { + if (ps[opt] === undefined) ps[opt] = plugin.redisCfg.opts[opt]; + }); }; exports.merge_redis_ini = function () { @@ -79,7 +82,7 @@ exports.init_redis_shared = function (next, server) { }); } else { - var opts = plugin.redisCfg.opts; + let opts = JSON.parse(JSON.stringify(plugin.redisCfg.opts)); opts.host = plugin.redisCfg.server.host; opts.port = plugin.redisCfg.server.port; server.notes.redis = plugin.get_redis_client(opts, nextOnce); @@ -184,10 +187,7 @@ exports.redis_subscribe_pattern = function (pattern, next) { return next(); } - plugin.redis = require('redis').createClient({ - host: plugin.redisCfg.pubsub.host, - port: plugin.redisCfg.pubsub.port, - }) + plugin.redis = require('redis').createClient(plugin.redisCfg.pubsub) .on('psubscribe', function (pattern2, count) { plugin.logdebug(plugin, 'psubscribed to ' + pattern2); next(); @@ -206,10 +206,7 @@ exports.redis_subscribe = function (connection, next) { return next(); } - connection.notes.redis = require('redis').createClient({ - host: plugin.redisCfg.pubsub.host, - port: plugin.redisCfg.pubsub.port, - }) + connection.notes.redis = require('redis').createClient(plugin.redisCfg.pubsub) .on('psubscribe', function (pattern, count) { connection.logdebug(plugin, 'psubscribed to ' + pattern); next(); From 43aa47abd5a977b7a27d3db03774fbcc148b66d1 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 31 Jul 2017 00:29:30 -0700 Subject: [PATCH 2/3] use node 6 on appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index b9e69d5..8a2fc85 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ version: 1.0.{build} environment: - nodejs_version: "4" + nodejs_version: "6" # Install scripts. (runs after repo cloning) install: From fc9a3a7e0e01e8dc2c5b342993e294852a3bc557 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 31 Jul 2017 08:42:51 -0700 Subject: [PATCH 3/3] version bump 1.0.7 --- Changes.md | 4 ++++ package.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Changes.md b/Changes.md index 3314fa9..9b3065d 100644 --- a/Changes.md +++ b/Changes.md @@ -1,4 +1,8 @@ +# 1.0.7 - 2017-07-31 + +- apply config [opts] to pubsub settings #7 + # 1.0.6 - 2017-06-16 - eslint 4 compat diff --git a/package.json b/package.json index a197a3c..4261e01 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "haraka-plugin-redis", - "version": "1.0.6", + "version": "1.0.7", "description": "Redis plugin for Haraka & other plugins to inherit from", "main": "index.js", "directories": { "test": "test" }, "dependencies": { - "redis": "^2.6.5" + "redis": "^2.7.1" }, "devDependencies": { "eslint": "*",