Profile [env.*] cannot override LOCALSTACK_HOST (launcher value appended last)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 internal/container/start.go 中环境变量组装部分附近的第266–296行开始;比较 SF_S3_ENDPOINT 的检查和针对 MAIN_CONTAINER_NAME 的警告,以及 LOCALSTACK_HOST 的追加方式。检查附近有关容器环境构造的测试,然后为 profile 提供的 LOCALSTACK_HOST 添加覆盖。完成标准是:要么遵循 profile 值,要么给出清晰的警告说明该值被忽略,并且所选行为经过测试。
由索引模型根据 Issue 内容生成。
描述
Observed
Setting LOCALSTACK_HOST in a config [env.*] profile has no effect. The container receives the variable twice — the profile value first, lstk's computed value second — and Docker's last-wins semantics keep lstk's. docker inspect on a type = "snowflake" container started with a profile containing LOCALSTACK_HOST = "sf.example.test:4599" shows both entries; the emulator sees localhost.localstack.cloud:4599. Nothing warns that the profile value was dropped.
Where
internal/container/start.go on main (d9c83037):
:276env := resolvedEnv— the profile's variables come first;:281-285env = append(env, "GATEWAY_LISTEN=…", "MAIN_CONTAINER_NAME=…", "LOCALSTACK_HOST="+endpoint.Hostname+":"+c.Port)— lstk's own value is appended unconditionally after them.
The two neighbours already handle this collision: SF_S3_ENDPOINT (:292) is appended only when the profile did not set it (!envHasKey(resolvedEnv, "SF_S3_ENDPOINT")), and MAIN_CONTAINER_NAME (:266-275) emits a warning saying the profile value is ignored. LOCALSTACK_HOST does neither, so the profile value vanishes silently. (A LOCALSTACK_HOST exported in the host shell does win, because hostEnv is appended at :296 after lstk's line — so the two configuration channels behave differently.)
Context
Recorded in September 2026 while diagnosing a snowflake-next result-chunk 404 under lstk (the emulator advertised the host lstk injected but its hostname gate did not route it; that was fixed on the emulator side, which now routes any host it is told to advertise). For the default flow this is harmless: the value lstk injects, localhost.localstack.cloud:<published port>, is the right one. It only matters when a user needs a different advertised host — a non-loopback hostname for clients on other machines, or a reverse-proxy name — and reaches for the documented [env.*] mechanism to set it.
Expected
Either the profile wins — append lstk's LOCALSTACK_HOST only when the profile did not set it, with the same envHasKey guard SF_S3_ENDPOINT uses — or lstk warns that the profile value is ignored, as it does for MAIN_CONTAINER_NAME, and the config docs state that LOCALSTACK_HOST is launcher-owned.
Reproduce
[[containers]]
type = "snowflake"
port = "4599"
env = ["custom"]
[env.custom]
LOCALSTACK_HOST = "sf.example.test:4599"
lstk start, then docker inspect <container> --format '{{json .Config.Env}}' → both LOCALSTACK_HOST=sf.example.test:4599 and LOCALSTACK_HOST=localhost.localstack.cloud:4599, in that order; inside the container echo $LOCALSTACK_HOST prints the latter.
- 主要语言
- Go
- 星标
- 37
- 派生
- 8
- 平均合并
- 2 天 10 小时
- 30 天内合并 PR
- 37
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
agent-research agent-review-finding chore
难度 2/5 1-3 小时 新手友好度 66/100
jordansmall/spindrift#4922 ·
维护者通常 1 天内回复
-
gcsartifact: deleting a missing version returns an error可能已有人在做 @ktsoator 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
govulncheck
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
Change wording for init command success message可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement pkg:sdk
难度 2/5 1-3 小时 新手友好度 80/100
aws/aws-durable-execution-sdk-go#144 ·
维护者通常 1 天内回复