mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat!: allow disabling notifications (#15509)
Resolves https://github.com/coder/coder/issues/15513 Disables notifications when both `$CODER_NOTIFICATIONS_WEBHOOK_ENDPOINT` and `$CODER_EMAIL_SMARTHOST` are unset. Breaking change: `$CODER_EMAIL_SMARTHOST` is no longer set by default as `localhost:587`, meaning any deployments that make use of this default value will need to add it back. --------- Co-authored-by: Danny Kopping <danny@coder.com> Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
This commit is contained in:
@ -154,7 +154,7 @@ func TestSMTPDispatch(t *testing.T) {
|
||||
cfg := defaultNotificationsConfig(method)
|
||||
cfg.SMTP = codersdk.NotificationsEmailConfig{
|
||||
From: from,
|
||||
Smarthost: serpent.HostPort{Host: "localhost", Port: fmt.Sprintf("%d", mockSMTPSrv.PortNumber())},
|
||||
Smarthost: serpent.String(fmt.Sprintf("localhost:%d", mockSMTPSrv.PortNumber())),
|
||||
Hello: "localhost",
|
||||
}
|
||||
handler := newDispatchInterceptor(dispatch.NewSMTPHandler(cfg.SMTP, logger.Named("smtp")))
|
||||
@ -1112,7 +1112,7 @@ func TestNotificationTemplates_Golden(t *testing.T) {
|
||||
|
||||
var hp serpent.HostPort
|
||||
require.NoError(t, hp.Set(listen.Addr().String()))
|
||||
smtpConfig.Smarthost = hp
|
||||
smtpConfig.Smarthost = serpent.String(hp.String())
|
||||
|
||||
// Start mock SMTP server in the background.
|
||||
var wg sync.WaitGroup
|
||||
@ -1523,7 +1523,7 @@ func TestCustomNotificationMethod(t *testing.T) {
|
||||
cfg.SMTP = codersdk.NotificationsEmailConfig{
|
||||
From: "danny@coder.com",
|
||||
Hello: "localhost",
|
||||
Smarthost: serpent.HostPort{Host: "localhost", Port: fmt.Sprintf("%d", mockSMTPSrv.PortNumber())},
|
||||
Smarthost: serpent.String(fmt.Sprintf("localhost:%d", mockSMTPSrv.PortNumber())),
|
||||
}
|
||||
cfg.Webhook = codersdk.NotificationsWebhookConfig{
|
||||
Endpoint: *serpent.URLOf(endpoint),
|
||||
|
Reference in New Issue
Block a user