The documented environment variable names are the real ones #168
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
qwc-open/asiakirjat!168
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/env-var-docs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
internal/docs/builtin/docs/reference/configuration.mddescribed environment overrides as derivable from the YAML structure ("Use underscores for nested keys") and gave two examples that do not exist:ASIAKIRJAT_DATABASE_DRIVERASIAKIRJAT_DB_DRIVERASIAKIRJAT_AUTH_LDAP_ENABLEDASIAKIRJAT_LDAP_ENABLEDThe names come from explicit
env:struct tags ininternal/config/config.go, andapplyEnvToStructonly looks up tags that exist. An unrecognised variable is ignored with no warning, so anyone following the documented rule gets a setting that silently has no effect — the worst possible failure mode for a deployment knob.Four names genuinely do not follow their YAML path, which is why the rule can't work:
database.*→DB_,server.log_level→LOG_LEVEL(noSERVER_),auth.initial_admin.*→ADMIN_(noAUTH_INITIAL_),storage.base_path→STORAGE_PATH(not..._BASE_PATH).The same page also suggested:
There is no variable interpolation anywhere in config loading (no
os.ExpandEnv), so this stores the literal string${LDAP_PASSWORD}as the bind password. The LDAP bind then fails with a plain authentication error that points nowhere near the cause.Changes
config key → variabletable, plus a short table highlighting the four irregular names.true/1(soyesandonare false), unparseable integers are ignored silently, and an empty string is applied rather than falling back to the file.accesssection and bothproject_groupslists, which are slices the env walker never visits.${LDAP_PASSWORD}example, and add a "Keeping secrets out of the config file" section with the KubernetessecretKeyRefform.-configpath that doesn't exist is skipped silently (another symptom that reads as "my settings are ignored").readme.mdandCLAUDE.mdclaimed every setting has an override; narrowed to scalar settings.Verification
The 44-row table is checked against the code rather than typed by hand — every
env:tag inconfig.goappears exactly once in the table, no extras, and every YAML key named in it exists inconfig.go. Tests pass for./internal/config/...and./internal/docs/....Docs-only plus two prose lines; no behaviour change.
🤖 Generated with Claude Code
The configuration reference told readers to build variable names by joining nested YAML keys with underscores, and gave two examples that do not exist: ASIAKIRJAT_DATABASE_DRIVER and ASIAKIRJAT_AUTH_LDAP_ENABLED. The names are explicit `env:` struct tags, so the real ones are ASIAKIRJAT_DB_DRIVER and ASIAKIRJAT_LDAP_ENABLED. An unrecognised variable is ignored without a warning, so following the old rule produced a setting that silently had no effect. Replace the guessing rule with the complete list of all 44 variables, call out the four names that do not follow their YAML path (DB_, LOG_LEVEL, ADMIN_, STORAGE_PATH), document how booleans, integers and empty strings are parsed, and name the list-valued settings that have no override at all. The same page also suggested `bind_password: "${LDAP_PASSWORD}"`. There is no variable interpolation in the config file, so that stores 18 literal characters as the password and the bind fails with nothing pointing at the cause. Replace it with the environment variable, and add a section on keeping secrets out of the file, including the Kubernetes secretKeyRef form. readme.md and CLAUDE.md claimed every setting has an override; narrowed to scalar settings, which is what is true. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Marcel M. Otte <marcel.otte@mmo.to>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.