Skip to content

Commit 6b5244c

Browse files
cpcloudclaude
andcommitted
fix(config): clear deprecated Enabled field after env overrides
applyEnvOverrides repopulates Extraction.Enabled from MICASA_EXTRACTION_ENABLED after migrateRenamedKeys already cleared it. Clear it again post-env-overrides so both fields never coexist in the resolved config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0b665ff commit 6b5244c

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

internal/config/config.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,15 @@ func LoadFromPath(path string) (Config, error) {
404404
return cfg, err
405405
}
406406

407+
// Clear deprecated Enabled again: applyEnvOverrides may have
408+
// repopulated it from MICASA_EXTRACTION_ENABLED.
409+
if cfg.Extraction.Enabled != nil {
410+
if cfg.Extraction.Enable == nil {
411+
cfg.Extraction.Enable = cfg.Extraction.Enabled
412+
}
413+
cfg.Extraction.Enabled = nil
414+
}
415+
407416
// Normalize base URLs: strip trailing slash and /v1 suffix --
408417
// providers handle their own path construction.
409418
cfg.LLM.BaseURL = normalizeBaseURL(cfg.LLM.BaseURL)

internal/config/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ func TestEnabledEnvMigration(t *testing.T) {
766766
cfg, err := LoadFromPath(noConfig(t))
767767
require.NoError(t, err)
768768
assert.False(t, cfg.Extraction.IsEnabled())
769+
assert.Nil(t, cfg.Extraction.Enabled, "deprecated Enabled must be cleared after env migration")
769770
require.Len(t, cfg.Warnings, 1)
770771
assert.Contains(t, cfg.Warnings[0], "MICASA_EXTRACTION_ENABLED")
771772
assert.Contains(t, cfg.Warnings[0], "MICASA_EXTRACTION_ENABLE")

0 commit comments

Comments
 (0)