Skip to content

Commit d4dc7b5

Browse files
authored
Apply config overrides to the AgentRuntime layer, not EnvVar (#36519)
1 parent 4f6f02e commit d4dc7b5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/config/model/config_overrides.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func ApplyOverrideFuncs(config Config) {
4646
func applyOverrideVars(config Config) {
4747
for k, v := range overrideVars {
4848
if config.IsKnown(k) {
49-
config.Set(k, v, SourceEnvVar)
49+
config.Set(k, v, SourceAgentRuntime)
5050
}
5151
}
5252
}

pkg/config/setup/config_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,8 @@ external_config:
638638

639639
assert.Equal(config.GetString("api_key"), "overrided", "the api key should have been overrided")
640640
assert.Equal(config.GetString("dd_url"), "https://app.datadoghq.eu", "this shouldn't be overrided")
641+
assert.Equal(config.GetSource("api_key"), pkgconfigmodel.SourceAgentRuntime)
642+
assert.Equal(config.GetSource("dd_url"), pkgconfigmodel.SourceFile)
641643

642644
pkgconfigmodel.AddOverrides(map[string]interface{}{
643645
"dd_url": "http://localhost",
@@ -646,6 +648,8 @@ external_config:
646648

647649
assert.Equal(config.GetString("api_key"), "overrided", "the api key should have been overrided")
648650
assert.Equal(config.GetString("dd_url"), "http://localhost", "this dd_url should have been overrided")
651+
assert.Equal(config.GetSource("api_key"), pkgconfigmodel.SourceAgentRuntime)
652+
assert.Equal(config.GetSource("dd_url"), pkgconfigmodel.SourceAgentRuntime)
649653
}
650654

651655
func TestGetValidHostAliasesWithConfig(t *testing.T) {

0 commit comments

Comments
 (0)