Skip to content

Feature request: Would like to make use of multiple "env" sections in ecosystem.json via pm2 start commands #1037

Open
@elrasguno

Description

Hello!
Since you all are so very responsive, I figured I'd ask this question in the form of an issue. I'm making good use of ecosystem.json files for my app(s), and I'm trying to understand how I can use multiple env sections of the file without using the pm2 deploy command. Specifically, I'm using the pm2 startOrReload command via npm start, and it would be awesome if I could pass an additional argument to the command to specify which environment I'm running in.

Is this already possible, or would this require additional work?

Here is an example ecosystem.json file:

{
  "apps" : [
    {
      "name"         : "my-amazing-app",
      "script"       : "app.js",
      "min_uptime"   : "5000",
      "max_restarts" : "5",
      "instances"    : "max",
      "merge_logs"   : true,
      "env": {
        "ALL_THE_ENVS" : "BODY MASSAGE!!!!"
      },
      "env_dev-special-flower" : {
        "DEV_SPECIAL_FLOWER" : "WHEEEEEEEEEEEEEEEEEEEE"
      }
    }
  ]
}

Thanks very much in advance!

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions