defaultHandlers builds a set of known handlers; panics if any error occurs as these handlers should be valid at compile time.
(cfg codersdk.NotificationsConfig, log slog.Logger, store Store, ps pubsub.Pubsub)
| 123 | |
| 124 | // defaultHandlers builds a set of known handlers; panics if any error occurs as these handlers should be valid at compile time. |
| 125 | func defaultHandlers(cfg codersdk.NotificationsConfig, log slog.Logger, store Store, ps pubsub.Pubsub) map[database.NotificationMethod]Handler { |
| 126 | return map[database.NotificationMethod]Handler{ |
| 127 | database.NotificationMethodSmtp: dispatch.NewSMTPHandler(cfg.SMTP, log.Named("dispatcher.smtp")), |
| 128 | database.NotificationMethodWebhook: dispatch.NewWebhookHandler(cfg.Webhook, log.Named("dispatcher.webhook")), |
| 129 | database.NotificationMethodInbox: dispatch.NewInboxHandler(log.Named("dispatcher.inbox"), store, ps), |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | // WithHandlers allows for tests to inject their own handlers to verify functionality. |
| 134 | func (m *Manager) WithHandlers(reg map[database.NotificationMethod]Handler) { |
no test coverage detected