enable use with webpack by removing unnecessary fs call (#252)
This commit is contained in:
parent
608b607782
commit
5e8a34d6cf
1 changed files with 6 additions and 9 deletions
15
lib/nconf.js
15
lib/nconf.js
|
@ -5,8 +5,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var fs = require('fs'),
|
var async = require('async'),
|
||||||
async = require('async'),
|
|
||||||
common = require('./nconf/common'),
|
common = require('./nconf/common'),
|
||||||
Provider = require('./nconf/provider').Provider;
|
Provider = require('./nconf/provider').Provider;
|
||||||
|
|
||||||
|
@ -23,13 +22,12 @@ nconf.version = require('../package.json').version;
|
||||||
//
|
//
|
||||||
// Setup all stores as lazy-loaded getters.
|
// Setup all stores as lazy-loaded getters.
|
||||||
//
|
//
|
||||||
fs.readdirSync(__dirname + '/nconf/stores').forEach(function (file) {
|
['argv', 'env', 'file', 'literal', 'memory'].forEach(function (store) {
|
||||||
var store = file.replace('.js', ''),
|
var name = common.capitalize(store);
|
||||||
name = common.capitalize(store);
|
|
||||||
|
|
||||||
nconf.__defineGetter__(name, function () {
|
nconf.__defineGetter__(name, function () {
|
||||||
return require('./nconf/stores/' + store)[name];
|
return require('./nconf/stores/' + store)[name];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -41,4 +39,3 @@ nconf.loadFiles = common.loadFiles;
|
||||||
nconf.loadFilesSync = common.loadFilesSync;
|
nconf.loadFilesSync = common.loadFilesSync;
|
||||||
nconf.formats = require('./nconf/formats');
|
nconf.formats = require('./nconf/formats');
|
||||||
nconf.Provider = Provider;
|
nconf.Provider = Provider;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue