Skip to content

Commit

Permalink
updated Provider.load to respect sources hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
jstewmon authored and indexzero committed Jan 2, 2012
1 parent 6b6bf85 commit a216336
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/nconf/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit a216336

Please sign in to comment.