Skip to content

Commit

Permalink
fix: reloading with --update-env option #3192
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalygin committed Aug 25, 2024
1 parent 42341e7 commit 304fc5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ class API {
});

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

// Pass `env` option
that._operate(action, proc_name, env, function(err, ret) {
Expand Down
8 changes: 4 additions & 4 deletions lib/Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ var Utility = module.exports = {
},
extendExtraConfig : function(proc, opts) {
if (opts.env && opts.env.current_conf) {
if (opts.env.current_conf.env &&
typeof(opts.env.current_conf.env) === 'object' &&
Object.keys(opts.env.current_conf.env).length === 0)
delete opts.env.current_conf.env
// NOTE: `env` gets overriden by `Utility.extendMix` call. Instead, we want to merge envs.
if (opts.env.current_conf.env && typeof(opts.env.current_conf.env) === 'object')
Utility.extendMix(proc.pm2_env.env, opts.env.current_conf.env);
delete opts.env.current_conf.env;

Utility.extendMix(proc.pm2_env, opts.env.current_conf);
delete opts.env.current_conf;
Expand Down

0 comments on commit 304fc5e

Please sign in to comment.