diff --git a/lib/Common.js b/lib/Common.js index 476f5dd1..c1725760 100644 --- a/lib/Common.js +++ b/lib/Common.js @@ -206,12 +206,11 @@ Common.prepareAppConf = function(opts, app) { } app.env = [ - {}, app.filter_env ? filterEnv(process.env) : env, app.env || {} + {}, (app.filter_env && app.filter_env.length > 0) ? filterEnv(process.env) : env, app.env || {} ].reduce(function(e1, e2){ return util._extend(e1, e2); }); - app.pm_cwd = cwd; // Interpreter try { @@ -544,7 +543,7 @@ Common.safeExtend = function(origin, add){ if (!add || typeof add != 'object') return origin; //Ignore PM2's set environment variables from the nested env - var keysToIgnore = ['name', 'exec_mode', 'env', 'args', 'pm_cwd', 'exec_interpreter', 'pm_exec_path', 'node_args', 'pm_out_log_path', 'pm_err_log_path', 'pm_pid_path', 'pm_id', 'status', 'pm_uptime', 'created_at', 'windowsHide', 'username', 'merge_logs', 'kill_retry_time', 'prev_restart_delay', 'instance_var', 'unstable_restarts', 'restart_time', 'axm_actions', 'pmx_module', 'command', 'watch', 'versioning', 'vizion_runing', 'MODULE_DEBUG', 'pmx', 'axm_options', 'created_at', 'watch', 'vizion', 'axm_dynamic', 'axm_monitor', 'instances', 'automation', 'autorestart', 'unstable_restart', 'treekill', 'exit_code', 'vizion']; + var keysToIgnore = ['name', 'exec_mode', 'env', 'args', 'pm_cwd', 'exec_interpreter', 'pm_exec_path', 'node_args', 'pm_out_log_path', 'pm_err_log_path', 'pm_pid_path', 'pm_id', 'status', 'pm_uptime', 'created_at', 'windowsHide', 'username', 'merge_logs', 'kill_retry_time', 'prev_restart_delay', 'instance_var', 'unstable_restarts', 'restart_time', 'axm_actions', 'pmx_module', 'command', 'watch', 'filter_env', 'versioning', 'vizion_runing', 'MODULE_DEBUG', 'pmx', 'axm_options', 'created_at', 'watch', 'vizion', 'axm_dynamic', 'axm_monitor', 'instances', 'automation', 'autorestart', 'unstable_restart', 'treekill', 'exit_code', 'vizion']; var keys = Object.keys(add); var i = keys.length;