Unitech / Unitech/pm2

Common ENV for several apps in a JSON declaration

Open
#1,479 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T: Enhancement T: Question
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

It would be great to have a possibility to declare ENV variables in the json file and make them common for several apps. Currentelly I'm doing it like this:

{
  "apps": [
    {
       "name": "api",
       "env": {
         "API_HOST": "api.service.com",
         "API_PORT": 80
       }
    },
    {
       "name": "service",
       "env": {
          "API_HOST": "api.service.com",
          "API_PORT": 80
        }
    }
  ]
}

It would be great to be able to do something like:

{
  "apps": [
    {
       "name": "api"
    },
    {
       "name": "service"
    }
  ],
 "env": {
   "API_HOST": "api.service.com",
   "API_PORT": 80
 }
}

In both apps API_HOST and API_PORT variables will be available.

Or maybe there is a way to do this with json declaration? I couldn't find anything...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named in the issue. Start by tracing how PM2 reads JSON declarations and assigns environment variables to apps; done means a top-level env declaration is available to every listed app without repeating it in each app.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.