From 3c08fad1c912f5f7d24bc25a45793804584c35fe Mon Sep 17 00:00:00 2001 From: Michael Hart Date: Thu, 21 Jun 2012 18:04:37 +1000 Subject: [PATCH] Changed to as it's more accurate --- README.md | 4 ++-- lib/nconf/stores/env.js | 6 +++--- test/stores/env-test.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b9c8aaf..01a71f1 100644 --- a/README.md +++ b/README.md @@ -165,14 +165,14 @@ Responsible for loading the values parsed from `process.env` into the configurat // nconf.env('__'); // Get the value of the env variable 'database__host' - var dbHost = nconf.get('database:host'); + var dbHost = nconf.get('database:host'); // // Or use both options // nconf.env({ separator: '__', - filter: ['database__host', 'only', 'load', 'these', 'values'] + whitelist: ['database__host', 'only', 'load', 'these', 'values'] }); var dbHost = nconf.get('database:host'); ``` diff --git a/lib/nconf/stores/env.js b/lib/nconf/stores/env.js index 1aacd47..f4e94fc 100644 --- a/lib/nconf/stores/env.js +++ b/lib/nconf/stores/env.js @@ -21,10 +21,10 @@ var Env = exports.Env = function (options) { options = options || {}; this.type = 'env'; this.readOnly = true; - this.filter = options.filter || []; + this.whitelist = options.whitelist || []; this.separator = options.separator || ''; if (options instanceof Array) { - this.filter = options; + this.whitelist = options; } if (typeof(options) === 'string') { this.separator = options; @@ -52,7 +52,7 @@ Env.prototype.loadEnv = function () { this.readOnly = false; Object.keys(process.env).filter(function (key) { - return !self.filter.length || self.filter.indexOf(key) !== -1; + return !self.whitelist.length || self.whitelist.indexOf(key) !== -1; }).forEach(function (key) { if (self.separator) { self.set(common.key.apply(common, key.split(self.separator)), process.env[key]); diff --git a/test/stores/env-test.js b/test/stores/env-test.js index 9da60b8..6ae4cb0 100644 --- a/test/stores/env-test.js +++ b/test/stores/env-test.js @@ -16,8 +16,8 @@ vows.describe('nconf/stores/env').addBatch({ "should have the correct methods defined": function (env) { assert.isFunction(env.loadSync); assert.isFunction(env.loadEnv); - assert.isArray(env.filter); - assert.lengthOf(env.filter, 0); + assert.isArray(env.whitelist); + assert.lengthOf(env.whitelist, 0); assert.equal(env.separator, ''); } }