fix(env, jinja) self referencing env values and template substitution in lists #15

Merged
moritz merged 2 commits from eCommons/alakazam:fix/env-repeated-keys-and-jinja-lists into main 2026-09-14 11:55:24 +00:00
Contributor

Fix for two bugs:

  1. dotenv.set_key() rewrites every line that matches the key so self-referencing values (COMPOSE_FILE="$COMPOSE_FILE:compose.extra.yml) don't work correctly when used in an env: config.
  2. substitute_jinja_variable() never recursed into lists, so list-valued fields like initial-hooks got stringified and overwritten with a single corrupted string if they contained a template.
Fix for two bugs: 1. `dotenv.set_key()` rewrites every line that matches the key so self-referencing values (`COMPOSE_FILE="$COMPOSE_FILE:compose.extra.yml`) don't work correctly when used in an `env:` config. 2. `substitute_jinja_variable()` never recursed into lists, so list-valued fields like initial-hooks got stringified and overwritten with a single corrupted string if they contained a template.
dannygroenewegen added 2 commits 2026-09-14 09:47:03 +00:00
dotenv.set_key() rewrites every line sharing a key, breaking recipes
that legitimately repeat a key (e.g. COMPOSE_FILE) to accumulate a
value via bash expansion.

Values that reference their own key (e.g. "$COMPOSE_FILE:extra.yml") are
now routed to a new set_extending_key(), which only touches the one
matching line by uncommenting or appending it, leaving every other line
sharing that key untouched.
substitute_jinja_variable() only recursed into dict values; a list value
fell into the scalar branch, where str(value) stringified the whole list
dannygroenewegen marked the pull request as work in progress 2026-09-14 09:47:07 +00:00
dannygroenewegen marked the pull request as ready for review 2026-09-14 09:47:17 +00:00
dannygroenewegen requested review from moritz 2026-09-14 09:47:28 +00:00
moritz merged commit f3e283ee99 into main 2026-09-14 11:55:24 +00:00
dannygroenewegen deleted branch fix/env-repeated-keys-and-jinja-lists 2026-09-14 12:11:23 +00:00
Sign in to join this conversation.