Skip to content

Fix service environment precedence and interpolation sources - #177

Merged
Mcrich23 merged 5 commits into
mainfrom
fix/service-environment-precedence
Nov 14, 2026
Merged

Mcrich23 merged 5 commits into
mainfrom
fix/service-environment-precedence

Conversation

@Mcrich23

@Mcrich23 Mcrich23 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Fixes which environment variables up passes to a container:

  • .env provides values for ${VARIABLE} substitutions. Its variables are no longer automatically added to every container or allowed to override env_file values.
  • When a service lists multiple env_file files, later files override earlier ones.
  • Explicit environment values override file values, including empty strings and values containing ${...}.

For example, if app.env contains MODE=production and .env contains MODE=development, a service using env_file: app.env now receives MODE=production. Setting environment: {MODE: "${MODE}"} explicitly uses the substitution value instead.

Added regression coverage using temporary env files and the same environment assembly function that up calls. Updated the README to reflect the fixed behavior. Null values, bare-key inheritance, dotenv parsing, and remaining interpolation limitations are outside this change.

Validation: 67 static unit tests across 7 suites passed, including environment assembly, interpolation, file loading, and list-form environment tests. git diff --check passes. No dynamic tests or Container operations ran.

Related work: overlaps the environment assembly changes in #102. #153 leaves that work to #102 and does not fix these precedence issues. This PR does not replace either PR in full.

References: environment precedence and env_file.

@Mcrich23
Mcrich23 marked this pull request as ready for review November 14, 2026 17:35
@Mcrich23
Mcrich23 merged commit 20190dc into main Nov 14, 2026
1 check passed
@Mcrich23
Mcrich23 deleted the fix/service-environment-precedence branch November 25, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant