Skip to content

Commit

Permalink
fix: support overriding MinAlertLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Nov 18, 2024
1 parent 84323d7 commit 87c916b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion internal/core/ini.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,13 @@ var coreOpts = map[string]func(*ini.Section, *Config) error{
},
"MinAlertLevel": func(sec *ini.Section, cfg *Config) error {
if !StringInSlice(cfg.Flags.AlertLevel, AlertLevels) {
level := sec.Key("MinAlertLevel").String() // .In("suggestion", AlertLevels)
level := sec.Key("MinAlertLevel").String()

values := sec.Key("MinAlertLevel").StringsWithShadows(",")
if len(values) > 0 {
level = values[len(values)-1]
}

if index, found := LevelToInt[level]; found {
cfg.MinAlertLevel = index
} else {
Expand Down Expand Up @@ -239,6 +245,12 @@ var coreOpts = map[string]func(*ini.Section, *Config) error{
},
"NLPEndpoint": func(sec *ini.Section, cfg *Config) error { //nolint:unparam
cfg.NLPEndpoint = sec.Key("NLPEndpoint").MustString("")

values := sec.Key("NLPEndpoint").StringsWithShadows(",")
if len(values) > 0 {
cfg.NLPEndpoint = values[len(values)-1]
}

return nil
},
}
Expand Down

0 comments on commit 87c916b

Please sign in to comment.