Skip to content

fix/config: merge env additional headers over config file headers - #1359

Merged
BolajiOlajide merged 2 commits into
mainfrom
fix/config-additional-headers-env-override
Aug 4, 2026
Merged

fix/config: merge env additional headers over config file headers#1359
BolajiOlajide merged 2 commits into
mainfrom
fix/config-additional-headers-env-override

Conversation

@BolajiOlajide

@BolajiOlajide BolajiOlajide commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes CPL-690

Previously, additional headers provided via the environment (SRC_HEADER_* / SRC_HEADERS) overwrote any additionalHeaders loaded 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-supplied Authorization header. The header keys are ultimately applied via http.Header.Set, which canonicalizes them, so lowercasing the map keys has no effect on the outgoing request.

Test plan

Added TestReadConfig cases 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.

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.
@BolajiOlajide BolajiOlajide self-assigned this Aug 4, 2026
@BolajiOlajide
BolajiOlajide requested review from a team August 4, 2026 14:20
@BolajiOlajide
BolajiOlajide enabled auto-merge (squash) August 4, 2026 14:20
@BolajiOlajide
BolajiOlajide merged commit 23e836a into main Aug 4, 2026
8 checks passed
@BolajiOlajide
BolajiOlajide deleted the fix/config-additional-headers-env-override branch August 4, 2026 14:30
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.

2 participants