Skip to content

Commit eb4f3f3

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 ec4239f commit eb4f3f3

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
@@ -388,6 +388,15 @@ func LoadFromPath(path string) (Config, error) {
388388
return cfg, err
389389
}
390390

391+
// Clear deprecated Enabled again: applyEnvOverrides may have
392+
// repopulated it from MICASA_EXTRACTION_ENABLED.
393+
if cfg.Extraction.Enabled != nil {
394+
if cfg.Extraction.Enable == nil {
395+
cfg.Extraction.Enable = cfg.Extraction.Enabled
396+
}
397+
cfg.Extraction.Enabled = nil
398+
}
399+
391400
// Normalize base URLs: strip trailing slash and /v1 suffix --
392401
// providers handle their own path construction.
393402
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)