Closed phra closed 6 years ago
@vmarchaud it's already merged to pm2? I still can't see the env
vars from deploy within my app.
@lardissone can you clone this repository and npm link
this package in your project to see if it fixes the problem? thanks.
@phra I've linked the repo and seems to work from client side. At least it executes the post-deploy
with the ENV vars correctly.
Previously:
○ executing post-deploy `npm install && pm2 startOrRestart pm2.config.js --env production`
After fix:
○ executing post-deploy `export NODE_ENV=production PORT=8400 JWT_SECRET=[redacted] JWT_EXPIRATION_MINUTES=60 MONGO_URI=[redacted] MONGO_URI_TESTS=[redacted] && npm install && pm2 startOrRestart pm2.config.js --env production`
But env vars are still not available within the app on the server.
you should use pm2 startOrReload pm2.config.js --env production --update-env
to tell PM2 to actually pickup the new environment and inject it inside the new processes
@vmarchaud I've added --update-env
and still no luck trying to access process.env.JWT_SECRET
for example.
i will try to debug it..
@lardissone pls create a new ticket regarding the --update-env
bug. thanks.
fixes #102