From 51653e64862ddf4757b099d43513d53ea07c5941 Mon Sep 17 00:00:00 2001 From: Rob Rodriguez Date: Mon, 20 Jan 2014 15:28:38 -0800 Subject: [PATCH 1/3] Passing the value parameter to the providers The nconf-redis provider needs the value for some reason, if its absent this call will fail. It should be there anyway. --- lib/nconf/provider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nconf/provider.js b/lib/nconf/provider.js index 93200a3..1e32860 100644 --- a/lib/nconf/provider.js +++ b/lib/nconf/provider.js @@ -462,7 +462,7 @@ Provider.prototype.save = function (value, callback) { // if (store.save) { - return store.save(function (err, data) { + return store.save(value, function (err, data) { if (err) { return next(err); } From a3589fab9512a67f6bb15e4322fc1f71b2977dad Mon Sep 17 00:00:00 2001 From: Rob Rodriguez Date: Tue, 4 Feb 2014 04:56:42 -0800 Subject: [PATCH 2/3] Fixing provider issue in source --- lib/nconf/provider.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/nconf/provider.js b/lib/nconf/provider.js index 1e32860..b346ee9 100644 --- a/lib/nconf/provider.js +++ b/lib/nconf/provider.js @@ -210,6 +210,12 @@ Provider.prototype.init = function (options) { // Retrieves the value for the specified key (if any). // Provider.prototype.get = function (key, callback) { + if (typeof key === 'function') { + // Allow a * key call to be made + callback = key; + key = null; + } + // // If there is no callback we can short-circuit into the default // logic for traversing stores. From 4b5030dbc2d626e678541cdf73feee122bd9c633 Mon Sep 17 00:00:00 2001 From: indexzero Date: Sun, 20 Sep 2015 01:02:59 -0700 Subject: [PATCH 3/3] [fix] Only merge actual objects, not `null` values. Fixes #150. --- lib/nconf/provider.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nconf/provider.js b/lib/nconf/provider.js index b346ee9..d35b820 100644 --- a/lib/nconf/provider.js +++ b/lib/nconf/provider.js @@ -250,7 +250,7 @@ Provider.prototype.get = function (key, callback) { response = value; // Merge objects if necessary - if (typeof response === 'object' && !Array.isArray(response)) { + if (response && typeof response === 'object' && !Array.isArray(response)) { mergeObjs.push(response); response = undefined; } @@ -262,7 +262,7 @@ Provider.prototype.get = function (key, callback) { response = store.get(key); // Merge objects if necessary - if (typeof response === 'object' && !Array.isArray(response)) { + if (response && typeof response === 'object' && !Array.isArray(response)) { mergeObjs.push(response); response = undefined; }