diff --git a/notify/factory.go b/notify/factory.go index 6ca64810..a9051589 100644 --- a/notify/factory.go +++ b/notify/factory.go @@ -59,12 +59,6 @@ type NotificationChannel interface { notify.ResolvedSender } -func Factory(receiverType string) (func(receivers.FactoryConfig) (NotificationChannel, error), bool) { - receiverType = strings.ToLower(receiverType) - factory, exists := receiverFactories[receiverType] - return factory, exists -} - // wrap wraps the notifier's factory errors with receivers.ReceiverInitError func wrap[T NotificationChannel](f func(fc receivers.FactoryConfig) (T, error)) func(receivers.FactoryConfig) (NotificationChannel, error) { return func(fc receivers.FactoryConfig) (NotificationChannel, error) { @@ -170,14 +164,16 @@ func (ib IntegrationsBuilder) buildReceiverIntegration(r *GrafanaReceiver, tmpl Err: err, } } - receiverFactory, exists := Factory(r.Type) + + receiverType := strings.ToLower(r.Type) + factory, exists := receiverFactories[receiverType] if !exists { return nil, InvalidReceiverError{ Receiver: r, Err: fmt.Errorf("notifier %s is not supported", r.Type), } } - n, err := receiverFactory(factoryConfig) + n, err := factory(factoryConfig) if err != nil { return nil, InvalidReceiverError{ Receiver: r,