I'm aware about how to pass variables to node.js using pm2. But how do I read them? process.argv
doesn't contain it.
This is what I'm referring to.
Passing environment variables to node.js using pm2
UPDATE
pm2 start file_name.js -- -my_port 8080
is the right way to do it. process.argv
will contain the arguments.
But running pm2 describe file_name
still shows args -3000 which is a cached value.
Restarting the system gives me the argument that was passed last before restart, which was 3000 in my case.