devcontainers / devcontainers/cli
How to specify the default value with colon for localEnv.
- 主要语言
- TypeScript
- 星标
- 3k
- 派生
- 457
- 平均合并
- 13 小时 17 分钟
- 30 天内合并 PR
- 6
描述
Hi DevContainers Team,
The case for me is to set the index url for pip, so what I do is something like
```json
{
...
"remoteEnv": {
"PIP_INDEX_URL": "${localEnv:PIP_INDEX_URL:https://pypi.org/simple}"
}
}
```
I perfer a default value to handle the cases that `PIP_INDEX_URL` does not exist. But it turns out that when the env does not exist, the corresponding env in the vscode context will be set to `https` rather than `https://pypi.org/simple`. Any clues to make it happen?
Seems it is related to the code here:
https://github.com/devcontainers/cli/blob/f7d4c853bf8c284d784173f3e915a34d961b0b55/src/spec-common/variableSubstitution.ts#L85
If I understand correctly, one option could be setting the split limit to 1, and maybe another approach is that we can avoid set the env in the context if the value is empty.
Thanks in advance.
贡献指南
调研方向
从 src/spec-common/variableSubstitution.ts 中引用行附近开始,跟踪环境变量不存在时 localEnv 表达式是如何被拆分的。复现提供的 PIP_INDEX_URL 示例,并确认问题修复后,包含冒号在内的完整默认 URL 会被保留。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 50/100