diff --git a/lib/forever/monitor.js b/lib/forever/monitor.js index deadc902..096dbac5 100644 --- a/lib/forever/monitor.js +++ b/lib/forever/monitor.js @@ -53,6 +53,7 @@ var Monitor = exports.Monitor = function (script, options) { this.sourceDir = options.sourceDir; this.cwd = options.cwd || null; this.env = options.env || {}; + this.hideEnv = options.hideEnv || {}; // // Setup log files and logger for this instance. @@ -361,23 +362,25 @@ Monitor.prototype.kill = function (forceStop) { // Monitor.prototype._getEnv = function () { var self = this, - extra = Object.keys(this.env), merged = {}; - if (extra.length === 0) { - return process.env; - } - function addKey (key, source) { merged[key] = source[key] } - + // // Mixin the key:value pairs from `process.env` and the custom // environment variables in `this.env`. // - Object.keys(process.env).forEach(function (k) { addKey(k, process.env) }); - extra.forEach(function (k) { addKey(k, self.env) }); + for(var k in process.env) { + if(!self.hideEnv[k]) { + addKey(k, process.env); + } + } + + for(var k in this.env) { + addKey(k, this.env); + } return merged; };