Version v0.5.7 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.
Add a configuration setting
The rules are in internal/config/AGENTS.md.
This recipe adds a server setting (internal/config/server.go); a developer
CLI setting lives in internal/config/config.go and follows the same steps.
Write the tests first in
internal/config/: the default, the value read fromDEXAFLOW_<KEY>and fromLEOFLOW_<KEY>, and the valuesValidaterefuses.env_binding_test.goandexecution_test.goshow the shape. Run them and watch them fail.Add the field to its section struct in
server.go, with amapstructuretag and a GoDoc comment that says what it changes and what the default does.Register the default in
serverDefaults. Without it the environment variable never binds (TestDocumentedEnvVarsBind). Pick the default that keeps today’s behavior, so the setting is inert until someone sets it (ADR 0068).Validate it. Add a check to
(*ServerConfig).Validatethat refuses a bad value at boot, naming the key and what it accepts.Use it where it applies, and test that path through its real entry point, not only the config struct.
Document it. The settings tables of the configuration reference are generated from
internal/config: give the key its purpose and edition ininternal/tools/configref/settings.yaml(or let the field’s GoDoc describe it), make sure aBEGIN GENERATED configref settingsblock on the page covers it, and runmake gen-config-reference. Never edit the generated rows by hand;go test ./internal/tools/configref/fails on a stale page. Mention it on the page of the feature it tunes, and on upgrades when an operator should act. Record a changelog fragment of kindAdded(record a change).Expose it in the chart when operators set it through Helm: add a Helm value.
Check:
go test ./internal/config/ ./internal/tools/configref/ make lint test