Skip to content

Commit 304fc5e

Browse files
committed
fix: reloading with --update-env option #3192
1 parent 42341e7 commit 304fc5e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/API.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ class API {
10711071
});
10721072

10731073
// When we are processing JSON, allow to keep the new env by default
1074-
env.updateEnv = true;
1074+
env.updateEnv = typeof(opts.updateEnv) === 'undefined' ? true : opts.updateEnv;
10751075

10761076
// Pass `env` option
10771077
that._operate(action, proc_name, env, function(err, ret) {

lib/Utility.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ var Utility = module.exports = {
3333
},
3434
extendExtraConfig : function(proc, opts) {
3535
if (opts.env && opts.env.current_conf) {
36-
if (opts.env.current_conf.env &&
37-
typeof(opts.env.current_conf.env) === 'object' &&
38-
Object.keys(opts.env.current_conf.env).length === 0)
39-
delete opts.env.current_conf.env
36+
// NOTE: `env` gets overriden by `Utility.extendMix` call. Instead, we want to merge envs.
37+
if (opts.env.current_conf.env && typeof(opts.env.current_conf.env) === 'object')
38+
Utility.extendMix(proc.pm2_env.env, opts.env.current_conf.env);
39+
delete opts.env.current_conf.env;
4040

4141
Utility.extendMix(proc.pm2_env, opts.env.current_conf);
4242
delete opts.env.current_conf;

0 commit comments

Comments
 (0)