MCPcopy Index your code
hub / github.com/coder/coder / defaultHandlers

Function defaultHandlers

coderd/notifications/manager.go:125–131  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

123
124// defaultHandlers builds a set of known handlers; panics if any error occurs as these handlers should be valid at compile time.
125func 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.
134func (m *Manager) WithHandlers(reg map[database.NotificationMethod]Handler) {

Callers 1

NewManagerFunction · 0.85

Calls 4

NewSMTPHandlerFunction · 0.92
NewWebhookHandlerFunction · 0.92
NewInboxHandlerFunction · 0.92
NamedMethod · 0.80

Tested by

no test coverage detected