From e631d239d57955898247211d2fa0c49882f94dd1 Mon Sep 17 00:00:00 2001 From: indexzero Date: Mon, 29 Aug 2011 15:19:55 -0400 Subject: [PATCH] [fix] Lazy-load any CLI arguments from `optimist` --- 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 b58c782..c214ba6 100644 --- a/lib/nconf/provider.js +++ b/lib/nconf/provider.js @@ -6,7 +6,6 @@ */ var async = require('async'), - optimist = require('optimist'), common = require('./common'), stores = require('./stores'); @@ -236,7 +235,11 @@ Provider.prototype.__defineGetter__('useArgv', function () { // Provider.prototype.__defineSetter__('useArgv', function (val) { this._useArgv = val || false; - this.overrides = this.overrides || optimist.argv; + + if (this._useArgv) { + this._argv = this._argv || require('optimist').argv; + this.overrides = this.overrides || this._argv; + } }); //