cli(ux): rename 'node env' → 'NODE_ENV' and show selected --env profile in describe command#6022
Open
bulgarian-beast wants to merge 6 commits intoUnitech:developmentfrom
Open
Conversation
The label mimicked a sentence rather than the well-known env var name. This change clarifies that the value shown is the NODE_ENV variable.
Persist the selected ecosystem env profile name during env merge as pm2_env_name, and display it in pm2-describe as 'PM2 --env'. Also guard NODE_ENV display to avoid undefined values. Output-only UX improvement.
…e result - Save the provided `--env <name>` as `pm2_env_name` on the computed config. - Keep env merge order unchanged (deploy -> base env -> env_<name>). - Mirror `pm2_env_name` onto the returned object so UX (pm2 describe) can read it. - Do NOT infer or carry over when `--env` is omitted; describe will fall back to "default".
Try/pm2 env sticky
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
node env→NODE_ENVinpm2 describe.pm2 describe:PM2 --env, which shows the ecosystem profile selected with--env <name>(e.g.,test,production).pm2_env_nameso the UX layer can display it.Why
Users often confuse the old “node env” label with PM2’s ecosystem profile. This PR:
NODE_ENV.--env, which previously wasn’t visible anywhere indescribe.Output:
How
lib/Common.jsWhen merging environment variables, persist the selected profile name on the process config:
pm2_env_name = <env_name>(or'default'when unset).lib/API/UX/pm2-describe.jsNODE_ENV(guarded: showsN/Aif unset).PM2 --envusingpm2_env_name(fallback to'default').Behavior / Compatibility
--envis provided,PM2 --envshowsdefault.NODE_ENVisn’t set, it showsN/Ainstead ofundefined.Before / After (example)
Before
After
Test plan (manual)
Notes for reviewers