Support variable expansion in DotEnv features
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.3k
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 283
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 未指定文件或测试;首先定位 Node 的 DotEnv 实现及其现有测试覆盖范围。跟踪值的解析和解析结果,然后为 ${APPLICATION_PORT} 的展开以及覆盖和顺序的预期行为定义测试。完成的标准是实现所提议的展开行为,并由测试覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- backend
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 52/100