Commit 8c8210e
authored
fix(sdk): stop injecting ECLOUD_PLATFORM_HOST into publicEnv (#151)
## Summary
Companion to ecloud-platform
[#154](Layr-Labs/ecloud-platform#154), which
removes the bulk \`spec.Env\` → \`tee-env-*\` propagation in favor of
the platform setting \`tee-env-ECLOUD_PLATFORM_HOST\` directly from
\`cfg.DeriveAppHostname(appAddress)\`. With that landing, the CLI's
client-side injection of the same value into \`publicEnv\` becomes
redundant *and* harmful: it puts a platform-derived value into the
user's on-chain release blob, where it shows up in \`ecloud compute app
info\`, the verify dashboard, and any consumer that reads
\`Release.publicEnv\`. Worse, releases cut against an environment whose
\`AppBaseDomain\` later changes carry a stale hostname forever.
## Change
```diff
- // 4a. Inject the platform-routed hostname as a public env var so
- // the VM entrypoint's setup_tls knows which hostname to obtain a
- // cert for. Platform routing expects every app to answer on
- // <addr>.<platformEnv>.<appBaseDomain>, so this replaces the
- // compute-tee model where the user supplied DOMAIN manually. The
- // user's DOMAIN env var (if any) is carried separately in the env
- // file and is additive: setup_tls issues a cert for both.
- const platformHost = derivePlatformHost(environmentConfig, options.appId);
- if (platformHost !== "") {
- publicEnv["ECLOUD_PLATFORM_HOST"] = platformHost;
- logger.info(`Platform hostname: ${platformHost}`);
- }
+ // ECLOUD_PLATFORM_HOST is intentionally NOT injected into publicEnv.
+ // The platform sets it directly as tee-env-* metadata at VM-create
+ // time (see ecloud-platform pkg/services/infraService/providers/gcp/
+ // compute.go). Platform-derived values belong in platform metadata.
```
\`derivePlatformHost\` itself stays exported in
\`config/environment.ts\` — external consumers (e.g.
\`scripts/e2e/lib/cli.sh\` in ecloud-platform's e2e harness) use it for
client-side prediction when they need to know the platform-routed
hostname before calling \`/info\`.
## Test plan
- [x] \`pnpm tsc --noEmit\` — clean.
- [x] \`pnpm vitest run\` — 35 pass (no behavior change for any test
that doesn't introspect publicEnv contents).
- [ ] After ecloud-platform #154 merges and a new CLI tag (1.0.0-devep5)
ships, re-run
\`scripts/e2e/scenarios/02_platform_deploy_then_platform_upgrade.sh\`
against sepolia-dev.
## Compatibility
This PR is **safe to land before ecloud-platform #154 is deployed**:
- Old CLIs (\`<= 1.0.0-devep4\`) continue to inject
\`ECLOUD_PLATFORM_HOST\` into publicEnv. The platform reads it from
\`spec.Env\` and propagates as \`tee-env-*\`. Works as before.
- New CLI (this PR) doesn't inject. Platform pre-#154 reads no
\`ECLOUD_PLATFORM_HOST\` from \`spec.Env\`, doesn't emit
\`tee-env-ECLOUD_PLATFORM_HOST\`, VM's setup_tls falls back to its
localhost default and Caddy serves on the user's \`DOMAIN\` only. **No
platform routing until #154 lands** — the user app still gets a cert for
any custom \`DOMAIN\` they set.
- Once #154 ships, both CLIs work: the new CLI relies on platform-set
metadata; the old CLI's injected publicEnv \`ECLOUD_PLATFORM_HOST\` is
harmless because the platform's loop is gone.
## Companion PR
- ecloud-platform
[#154](Layr-Labs/ecloud-platform#154) — drops
the spec.Env → tee-env-* loop and explicitly emits the platform
hostname.1 file changed
Lines changed: 13 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
151 | 150 | | |
152 | 151 | | |
153 | 152 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
0 commit comments