Pm2: List env variables in `pm2 describe id`

Created on 5 Sep 2014  Â·  8Comments  Â·  Source: Unitech/pm2

ENV variables can be passed to a script inside the app.json file. It would be useful to list those features next to the other keys inside it.

Is this the appropriate file to edit? https://github.com/Unitech/PM2/blob/master/lib/CliUx.js

Enhancement Question

Most helpful comment

Yes but there are a lot of environment variables, otherwise you can do 'pm2
prettylist'. Or there are chances that added environment variables are
available in pm2_env
On Sep 5, 2014 10:21 PM, "Ehtesh Choudhury" [email protected]
wrote:

ENV variables can be passed to a script inside the app.json file. It would
be useful to list those features next to the other keys inside it.

Is this the appropriate file to edit?
https://github.com/Unitech/PM2/blob/master/lib/CliUx.js

—
Reply to this email directly or view it on GitHub
https://github.com/Unitech/PM2/issues/691.

All 8 comments

https://github.com/Unitech/PM2/blob/master/lib/CliUx.js#L77 yes it is ;)

Yes but there are a lot of environment variables, otherwise you can do 'pm2
prettylist'. Or there are chances that added environment variables are
available in pm2_env
On Sep 5, 2014 10:21 PM, "Ehtesh Choudhury" [email protected]
wrote:

ENV variables can be passed to a script inside the app.json file. It would
be useful to list those features next to the other keys inside it.

Is this the appropriate file to edit?
https://github.com/Unitech/PM2/blob/master/lib/CliUx.js

—
Reply to this email directly or view it on GitHub
https://github.com/Unitech/PM2/issues/691.

Isn't it worth listing the variables explicitly mentioned in the app.json file? I didn't know pm2 prettylist existed. I'll see if that solves my pain point.

I find it weird working with ENV variables (i.e. HOME, PATH etc.), if you need to configure variables why don't you use a configuration file with json or yaml?

To be specific, I meant env variables that are specified like this:

[{
  "name" : "app-server",
  "script": "server.js",
  "instances" : "max",
  "out_file" : "/var/log/pm2/app.log",
  "error_file" : "/var/log/pm2/app-err.log",
  "exec_mode" : "cluster_mode",
  "env": {
    "NODE_ENV": "staging",
    "NODE_ROLE": "app",
    "NODE_PORT": 8001
  }
}]

Not just any ENV variables attached to the shell, like $HOME and $PATH. This is kind of useful to me, if only because I have a few app.json files with different parameters. I switch NODE_ENV to production and staging, and NODE_ROLE to app and worker.

Indeed this is a better explanation that we might work on. What about showing all variables that are containing NODE_? We could also add the DEBUG env variable that is used in a lot of applications with the debug module.

What about this? @rlidwka @Unitech any thoughts?

It's quite easy to save and display these extra env variable, just by editing the Common.js file.
But displaying these env variable will be a mess via https://github.com/LearnBoost/cli-table

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phra picture phra  Â·  3Comments

FujiHaruka picture FujiHaruka  Â·  3Comments

chaos-git picture chaos-git  Â·  3Comments

morfies picture morfies  Â·  3Comments

lefam picture lefam  Â·  3Comments