Below is a very simple process.json to launch a js app with pm2.
My goal is to have the process kick off the below node_args but only for non-prod launches. So, for example, if a certain environment variable is set a certain way, then trigger the node_args, otherwise ignore them.
Is this possible? If not, any workarounds I can do?
{
apps : [
{
name : 'API',
script : './app.js',
node_args: ["--inspect","--debug=0.0.0.0:7000"],
env: {
NODE_ENV: 'development'
}
}
]
}
I know that it's possible to throw node_args at the command line, however the goal is to run this in docker where the "run" command is static to the source image so that's not really viable.
Here is the CMD entry in my Dockerfile:
CMD [ "pm2-docker", "--auto-exit", "--watch", "process.json"]