feat(render): port service-local env interpolation to Deno#21
Conversation
- Variable interpolation: ${VAR}, ${VAR-default}, ${VAR:-default}, $VAR, $$
- Variable scope resolution: shell env -> env_file(s) -> service.environment
- Deep interpolation through all string values in compose structures
- Path absolutization for env_file and bind-mount paths
- Strict mode (fail on unresolved) and non-strict mode (leave as-is with warnings)
- CLI pipeline: resolveConfig -> generateStacks -> renderStack -> output
- 49 comprehensive tests covering all interpolation forms and edge cases
wax911
left a comment
There was a problem hiding this comment.
Review notes against #5:
-
Missing env files are silently swallowed in
buildServiceScope(). The result type advertises warnings for missing env files, and the current local-stack behavior warns. Do not silently continue without surfacing which service/env file was missing. -
Path resolution uses manual string concatenation and a custom resolver (
${projectDir}/${relPath},${repoRoot}/${relPath}, manual/splitting). Use@std/pathhelpers consistently so paths are normalized and predictable on both macOS and Linux. -
Strict unresolved detection appears focused on simple
${VAR}patterns. Since this renderer also supports plain$VAR, strict mode should account for unresolved plain variables too, or explicitly document that strict only covers braced variables. -
absolutizeVolumeMount()only absolutizes./and../short-form bind sources. The original local-stack renderer also handled repo-relative bind paths containing/. Verify that existing local-stack bind mounts are covered. -
Keep render output writing in the command layer, but make sure tests cover full stack-file render from YAML input to
.rendered/<stack>.rendered.yml, not only in-memory interpolation helpers.
This is broadly on the right path, but the silent missing-env behavior and path-resolution shortcuts need tightening before closing #5.
Closes #5