From 9dd03dde0cbc6d868fe8a7d4607ce6d2d2596267 Mon Sep 17 00:00:00 2001 From: evoye Date: Sun, 29 Jan 2017 16:57:05 +0100 Subject: [PATCH] enable use with webpack by removing unnecessary fs call --- lib/nconf.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/nconf.js b/lib/nconf.js index 01231a75..09d6848e 100644 --- a/lib/nconf.js +++ b/lib/nconf.js @@ -5,8 +5,7 @@ * */ -var fs = require('fs'), - async = require('async'), +var async = require('async'), common = require('./nconf/common'), Provider = require('./nconf/provider').Provider; @@ -23,13 +22,12 @@ nconf.version = require('../package.json').version; // // Setup all stores as lazy-loaded getters. // -fs.readdirSync(__dirname + '/nconf/stores').forEach(function (file) { - var store = file.replace('.js', ''), - name = common.capitalize(store); +['argv', 'env', 'file', 'literal', 'memory'].forEach(function (store) { + var name = common.capitalize(store); - nconf.__defineGetter__(name, function () { - return require('./nconf/stores/' + store)[name]; - }); + nconf.__defineGetter__(name, function () { + return require('./nconf/stores/' + store)[name]; + }); }); // @@ -41,4 +39,3 @@ nconf.loadFiles = common.loadFiles; nconf.loadFilesSync = common.loadFilesSync; nconf.formats = require('./nconf/formats'); nconf.Provider = Provider; -