From a21633629014456b17dc3b45d565fe9c3327d15a Mon Sep 17 00:00:00 2001 From: Jonathan Stewmon Date: Mon, 19 Dec 2011 19:34:39 -0600 Subject: [PATCH] updated Provider.load to respect sources hierarchy --- lib/nconf/provider.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/nconf/provider.js b/lib/nconf/provider.js index 9807a41..56d0a71 100644 --- a/lib/nconf/provider.js +++ b/lib/nconf/provider.js @@ -343,17 +343,20 @@ Provider.prototype.load = function (callback) { } function loadSources () { + var sourceHierarchy = self.sources.splice(0); + sourceHierarchy.reverse(); + // // If we don't have a callback and the current // store is capable of loading synchronously // then do so. // if (!callback) { - mergeSources(loadBatch(self.sources)); + mergeSources(loadBatch(sourceHierarchy)); return loadBatch(getStores()); } - loadBatch(self.sources, function (err, data) { + loadBatch(sourceHierarchy, function (err, data) { if (err) { return callback(err); }