Feature request: Would like to make use of multiple "env" sections in ecosystem.json via pm2 start commands
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
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!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ecosystem.json example and the pm2 startOrReload command invoked through npm start. Trace how environment sections such as env_dev-special-flower are selected without pm2 deploy, then define the command argument behavior and verify that the chosen environment is applied when the command runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100