#Updating process env using pm2
16 messages · Page 1 of 1 (latest)
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
the env option refers to the pm2 environment, and not the environment variables available to the process
so whats the right usage
its in the page i sent
through the cli, its --update-env
i dont use pm2 through commands
i use it through functions
seems like what you're looking for is pm2.reload(processId, { updateEnv: true })
https://github.com/Unitech/pm2/blob/c4032e261a65bf7399d51370884f0d7e5c5f9c9a/types/index.d.ts#L114
https://github.com/Unitech/pm2/blob/c4032e261a65bf7399d51370884f0d7e5c5f9c9a/types/index.d.ts#L447C3-L453
this will update the env using the values available in process.env
i will restart it from another process, how i will change the env ?
the main process can just edit the env file through fs
can u send me an example please ?
how i will edit the env object
or have access to it