diff --git a/cli/job.go b/cli/job.go index 6b9bb351..58b43f8c 100644 --- a/cli/job.go +++ b/cli/job.go @@ -71,18 +71,19 @@ func runJobCmd() *cobra.Command { logger := log.NewCtxLogger(config.LogLevel, []string{config.AuditLogTraceIDHeaderKey}) crypto := crypto.NewAES(config.EncryptionSecretKeyKey) validator := validator.New() - var notifierMap map[string]interface{} - errr := json.Unmarshal([]byte(config.Notifiers), ¬ifierMap) - if errr != nil { - return fmt.Errorf("failed to parse notifier config: %w", errr) - } - 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{} + errr := json.Unmarshal([]byte(config.Notifiers), ¬ifierMap) + if errr != nil { + return fmt.Errorf("failed to parse notifier config: %w", errr) + } + 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) }