Skip to content

config: apply environment overrides before unmarshal - #902

Open
dlanov wants to merge 1 commit into
openconfig:mainfrom
dlanov:fix-833-collector-env
Open

config: apply environment overrides before unmarshal#902
dlanov wants to merge 1 commit into
openconfig:mainfrom
dlanov:fix-833-collector-env

Conversation

@dlanov

@dlanov dlanov commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #833

GNMIC_* environment variables were merged into Viper only after the
configuration had already been unmarshaled into Config. As a result,
nested collector configuration such as
GNMIC_CLUSTERING_LOCKER_ADDRESS was present in FileConfig but was
not reflected in the configuration object stored for collector mode.

Merge environment values before unmarshaling so both global and nested
configuration fields receive environment overrides.

Add a regression test verifying that:

  • GNMIC_CLUSTER_NAME populates the global cluster name
  • GNMIC_CLUSTERING_LOCKER_ADDRESS overrides the value from the configuration file
  • unrelated clustering values from the file remain intact

Testing:

  • go test ./pkg/config -run '^TestLoadEnvironmentOverridesConfig$' -count=1 -v
  • go test ./... -count=1
  • go vet ./...

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.

GNMIC_* environment variables are not interpolated in collector mode

1 participant