Support variable expansion in DotEnv features
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
What is the problem this feature will solve?
Sometimes it's helpful to derive the value of variables from other variables, using variable expansion.
For example, consider the following .env file:
APPLICATION_PORT: 8080
BASE_URL: http://localhost:8080
The APPLICATION_PORT and BASE_URL should have the same port. For reasons external to this issue, BASE_URL cannot be split into two variables without causing confusion.
If there are external overrides to APPLICATION_PORT, they won't remain in sync with BASE_URL.
What is the feature you are proposing to solve the problem?
Instead we could write .env files like this:
APPLICATION_PORT: 8080
BASE_URL: http://localhost:${APPLICATION_PORT}
This is already supported by at least bash, and the concept of variable expansion in environmental configuration is also common in ecosystems such as Kubernetes.
What alternatives have you considered?
- Using
dotenvx - Splitting variables up into their lowest common set
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
The issue does not name files or tests; start by locating Node's DotEnv implementation and its existing test coverage. Trace how values are parsed and resolved, then define tests for ${APPLICATION_PORT} expansion and expected behavior for overrides and ordering. Done means the proposed expansion behavior is implemented and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100