My old ecosystem.config.js file had these env variables
module.exports = {
apps: [
{
name: 'test_app',
script: './bin/www',
env: {
GENERIC_VALUE: 'old value',
FIRST_TEST_VALUE: 'first value',
},
},
],
};
My replacement file has some changes to the env object
env: {
GENERIC_VALUE: 'new value',
SECOND_TEST_VALUE: 'second value',
},
In an attempt to implement these changes I run
$ pm2 restart ecosystem.config.js
To confirm these changes happened I run
$ pm2 env 0
This shows the generic value has changed, and the second key-value pair is now available, but the first key-value pair remains available. I don’t want this.
How do I get the first key-value pair to no longer be available? In other words, how to I get PM2 to simply refresh all env variables based upon what’s in the current ecosystem.config file?
I’ve tried these commands…
$ pm2 restart all --update-env
$ pm2 reload all
..but that first key-value pair still comes up.
The only thing that seems to work (per this answer) is to kill/start the process.
$ pm2 kill
$ pm2 start ecosystem.config.js
But this seems heavy handed. Is there any other way?