fix/config: merge env additional headers over config file headers - #1359
Merged
Conversation
Previously env-derived additional headers overwrote any additionalHeaders loaded from the config file entirely. Merge them instead, with env headers taking precedence, consistent with how the access token and endpoint are overridden. Config-file keys are normalized to lowercase to match the env-header convention, so env values correctly override differently-cased config keys and the authorization-conflict check catches them.
bahrmichael
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes CPL-690
Previously, additional headers provided via the environment (
SRC_HEADER_*/SRC_HEADERS) overwrote anyadditionalHeadersloaded from the config file entirely, silently dropping them. This merges the two sources instead — environment headers take precedence, consistent with how the access token and endpoint are already overridden. Config-file header keys are normalized to lowercase to match the env-header convention, so an environment header correctly overrides a differently-cased config key and the existing authorization-conflict check reliably detects a config-suppliedAuthorizationheader. The header keys are ultimately applied viahttp.Header.Set, which canonicalizes them, so lowercasing the map keys has no effect on the outgoing request.Test plan
Added
TestReadConfigcases covering: config headers preserved when endpoint/token come from the environment, config and env headers merged together, env headers overriding config headers, and env headers overriding a differently-cased config key.go test ./cmd/src/passes.