diff --git a/internal/server/server.go b/internal/server/server.go index 0f8db794..ed4aac90 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -53,18 +53,19 @@ func RunServer(config *Config) error { crypto := crypto.NewAES(config.EncryptionSecretKeyKey) validator := validator.New() - var notifierMap map[string]interface{} - err := json.Unmarshal([]byte(config.Notifiers), ¬ifierMap) - if err != nil { - return fmt.Errorf("failed to parse notifier config: %w", err) - } - var notifierConfigMap map[string]notifiers.Config - err = mapstructure.Decode(notifierMap, ¬ifierConfigMap) - if err != nil { - return fmt.Errorf("failed to parse notifier config: %w", err) - } notifierConfig := []notifiers.Config{} if config.Notifiers != "" { + var notifierMap map[string]interface{} + err := json.Unmarshal([]byte(config.Notifiers), ¬ifierMap) + if err != nil { + return fmt.Errorf("failed to parse notifier config: %w", err) + } + var notifierConfigMap map[string]notifiers.Config + err = mapstructure.Decode(notifierMap, ¬ifierConfigMap) + if err != nil { + return fmt.Errorf("failed to parse notifier config: %w", err) + } + for _, val := range notifierConfigMap { notifierConfig = append(notifierConfig, val) }