Skip to content

Commit 9109fb5

Browse files
committed
fix(notify): try to unmarshal notify.urls as JSON array
When notify.urls is configured as a JSON array in the config file, Viper's GetStringSlice may not parse it correctly. This fix attempts to unmarshal the raw string as JSON first, falling back to the original behavior if that fails.
1 parent df7da88 commit 9109fb5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

webapp/backend/pkg/notify/notify.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@ func (n *Notify) Send() error {
234234

235235
//retrieve list of notification endpoints from config file
236236
configUrls := n.Config.GetStringSlice("notify.urls")
237+
configString := n.Config.GetString("notify.urls")
238+
var jsonConfig []string
239+
err := json.Unmarshal([]byte(configString), &jsonConfig)
240+
if err == nil {
241+
configUrls = jsonConfig
242+
}
243+
237244
n.Logger.Debugf("Configured notification services: %v", configUrls)
238245

239246
if len(configUrls) == 0 {

0 commit comments

Comments
 (0)