Passing Environment Variables

Create a file called process.json with the following contents

{
"apps" : [{
"name" : "my-app",
"script" : "v1/app.js",
"env": {
"VERSION": 1.0.0
}
}]
}

Now run the app as follows

pm2 start process.json


The variable process.env.VERSION will now be available inside your nodejs application and will be set to the value 1.0.0