Skip to content

Pass the .env.example keys the backend reads to the compose containers - #594

Merged
haksungjang merged 5 commits into
mainfrom
fix/583-env-example-keys
Oct 25, 2026
Merged

haksungjang merged 5 commits into
mainfrom
fix/583-env-example-keys

Conversation

@haksungjang

Copy link
Copy Markdown
Contributor

docker-compose.yml only passes the keys it names in a service's environment, and 25 keys that .env.example offers and the backend reads were never named: the GATE_* axis switches, EPSS_*, LOGIN_THROTTLE_*, three rate limits, the default task time limits, STALE_QUEUED_SCAN_GRACE_SECONDS, REQUIRE_DB_ROLE_SEPARATION, GROUP_CASCADE_ENABLED, CONTAINER_SCAN_ALLOWED_REGISTRIES and the GitLab comment settings. They are now in the shared anchor. Where the code has a default, the value after :- is that default, because ${KEY:-} hands the process an empty string and os.getenv(KEY, default) returns it. Where the code has none, a test shows an empty value takes the same path as an unset one.

Checking every anchor default against the code turned up one live case of that problem: TOOLCHAIN_CACHE_ROOTS was passed as empty, which toolchain_cache_roots() reads as an empty list, so the toolchain cache cleaner had nothing to reclaim. Both compose files now carry the code's list. SCANCODE_ENABLED also differs (compose on, code and template off); it is recorded as a known difference rather than changed here, since flipping it changes what existing deployments scan.

test_config_key_contract.py now classifies every .env.example key as passed or kept out for a stated reason (compose substitution, image build metadata, host scripts, DSN parts, the owner DSN, dev only), checks each reason against the files it names, compares anchor defaults with the code's, and requires an empty-reads-as-unset check for every key passed empty without a code default. The template and reference pages now say which keys reach the containers; the build metadata lines in .env.example are commented out because the image sets them, and the backup retention text no longer claims the nightly backups read BACKUP_RETENTION_DAYS.

Every service's config hash changes with this anchor, so the upgrade UAT should be dispatched on this branch.

Closes #583

25 keys the template offered (GATE_*, EPSS_*, LOGIN_THROTTLE_*, rate
limits, task limits, GitLab comment settings) never reached a container.
They now sit in the shared anchor with the code's default after ":-".
TOOLCHAIN_CACHE_ROOTS defaulted to empty, which the code reads as an
empty list, so the cache cleaner reclaimed nothing; it now carries the
code's list. The key contract test classifies every template key as
passed or deliberately kept out, and checks compose defaults against
the code's.
The per-key reason check walked every backend module once per key and
hit the per-test timeout in CI.
Pin the anchor entries the default check cannot parse, account for every
key passed empty (crypto key now checked, forwarded tool settings listed),
require ENV rather than ARG for the image reason, and assert each wrong
reason fails for its own cause. Document shell precedence for the comment
tokens and fixed nightly backup retention, and add changelog upgrade notes.
docker-compose.yml passes SCANCODE_ENABLED=true while the code default,
and so the Helm chart, is off. Say so in .env.example and add the missing
reference row (EN/KO); keep the guard's exemption with that reason.
Compose passes SCANCODE_ENABLED=true by default; installs without compose,
Helm included, must set it explicitly. Docstring only.
@haksungjang
haksungjang force-pushed the fix/583-env-example-keys branch from 6a69c82 to 595e7db Compare October 25, 2026 01:04
@haksungjang
haksungjang merged commit 037c45b into main Oct 25, 2026
34 checks passed
@haksungjang
haksungjang deleted the fix/583-env-example-keys branch October 25, 2026 01:28
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.

Keys in .env.example that docker-compose.yml does not pass to containers

1 participant