lerna / lerna/lerna

.env file override priority

Open
#3,547 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: docs
Dominant language
TypeScript
Stars
36.1k
Forks
2.3k
Avg merge
1d 4h
Merged PRs (30d)
50

Description

Documentation issue
  • Reporting a typo
  • Reporting a documentation bug
  • Documentation improvement
  • Documentation feedback
Is there a specific documentation page you are reporting?

https://nx.dev/recipes/environment-variables/define-environment-variables#setting-environment-variables

Additional context or description

Order of environment variable files is listed as

apps/my-app/.[target-name].env
apps/my-app/.env.[target-name]
apps/my-app/.local.env
apps/my-app/.env.local
apps/my-app/.env
.[target-name].env
.env.[target-name]
.local.env
.env.local
.env

However, based on a test, it seems .env.[target-name] is taking priority over .[target-name].env

See you can see this on the env-script-priority branch of this repo: https://github.com/DannyMeister/lerna-react-env-test/tree/env-script-priority

This is a follow-up to #3540

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

Start with the environment-variable ordering on the linked Nx documentation page and compare it with the behavior described on the env-script-priority branch. Confirm which filename takes priority, then correct the listed order and verify it against the branch's test; this is a follow-up to #3540.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.