I have set environment variables in ~/.profile file as
export $VAR="Value"
If I change the values, Node application is not able to read updated value. This problem persists only if node application is run using pm2. It works if run using node command (node server.js)
What should I have to do to get updated value in pm2?
After updating values in ~/.profile file, I have done:
source ~/.profile
pm2 restart app1
Note: I have access to the system using root user only.
After updating values in ~/.profile file, you need to run the following commands:
source ~/.profile
pm2 restart app1 --update-env
This should work.