Skip to content

Commit 8baa141

Browse files
committed
Review comments
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent 598c9bb commit 8baa141

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

cli/testdata/server-config.yaml.golden

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ notifications:
516516
# (default: false, type: bool)
517517
forceTLS: false
518518
# Configure SMTP authentication options.
519-
email_auth:
519+
emailAuth:
520520
# Identity to use with PLAIN authentication.
521521
# (default: <unset>, type: string)
522522
identity: ""
@@ -530,7 +530,7 @@ notifications:
530530
# (default: <unset>, type: string)
531531
passwordFile: ""
532532
# Configure TLS for your SMTP server target.
533-
email_tls:
533+
emailTLS:
534534
# Enable STARTTLS to upgrade insecure SMTP connections using TLS.
535535
# (default: <unset>, type: bool)
536536
startTLS: false
@@ -565,25 +565,25 @@ notifications:
565565
# a non-graceful shutdown - but it also increases load on the database. It is
566566
# recommended to keep this option at its default value.
567567
# (default: 2s, type: duration)
568-
store-sync-interval: 2s
568+
storeSyncInterval: 2s
569569
# The notifications system buffers message updates in memory to ease pressure on
570570
# the database. This option controls how many updates are kept in memory. The
571571
# lower this value the lower the change of state inconsistency in a non-graceful
572572
# shutdown - but it also increases load on the database. It is recommended to keep
573573
# this option at its default value.
574574
# (default: 50, type: int)
575-
store-sync-buffer-size: 50
575+
storeSyncBufferSize: 50
576576
# How long a notifier should lease a message. This is effectively how long a
577577
# notification is 'owned' by a notifier, and once this period expires it will be
578578
# available for lease by another notifier. Leasing is important in order for
579579
# multiple running notifiers to not pick the same messages to deliver
580580
# concurrently. This lease period will only expire if a notifier shuts down
581581
# ungracefully; a dispatch of the notification releases the lease.
582582
# (default: 2m0s, type: duration)
583-
lease-period: 2m0s
583+
leasePeriod: 2m0s
584584
# How many notifications a notifier should lease per fetch interval.
585585
# (default: 20, type: int)
586-
lease-count: 20
586+
leaseCount: 20
587587
# How often to query the database for queued notifications.
588588
# (default: 15s, type: duration)
589-
fetch-interval: 15s
589+
fetchInterval: 15s

coderd/notifications/dispatch/smtp.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ var (
4545
plainTemplate string
4646
)
4747

48-
var loginWarnOnce sync.Once
49-
5048
// SMTPHandler is responsible for dispatching notification messages via SMTP.
5149
// NOTE: auth and TLS is currently *not* enabled in this initial thin slice.
5250
// TODO: implement DKIM/SPF/DMARC? https://github.com/emersion/go-msgauth
5351
type SMTPHandler struct {
5452
cfg codersdk.NotificationsEmailConfig
5553
log slog.Logger
54+
55+
loginWarnOnce sync.Once
5656
}
5757

5858
func NewSMTPHandler(cfg codersdk.NotificationsEmailConfig, log slog.Logger) *SMTPHandler {
@@ -439,7 +439,7 @@ func (s *SMTPHandler) auth(ctx context.Context, mechs string) (sasl.Client, erro
439439
}
440440

441441
// Warn that LOGIN is obsolete, but don't do it every time we dispatch a notification.
442-
loginWarnOnce.Do(func() {
442+
s.loginWarnOnce.Do(func() {
443443
s.log.Warn(ctx, "LOGIN auth is obsolete and should be avoided (use PLAIN instead): https://www.ietf.org/archive/id/draft-murchison-sasl-login-00.txt")
444444
})
445445

codersdk/deployment.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -711,13 +711,13 @@ when required by your organization's security policy.`,
711711
Name: "Email Authentication",
712712
Parent: &deploymentGroupNotificationsEmail,
713713
Description: "Configure SMTP authentication options.",
714-
YAML: "email_auth",
714+
YAML: "emailAuth",
715715
}
716716
deploymentGroupNotificationsEmailTLS = serpent.Group{
717717
Name: "Email TLS",
718718
Parent: &deploymentGroupNotificationsEmail,
719719
Description: "Configure TLS for your SMTP server target.",
720-
YAML: "email_tls",
720+
YAML: "emailTLS",
721721
}
722722
deploymentGroupNotificationsWebhook = serpent.Group{
723723
Name: "Webhook",
@@ -2333,7 +2333,7 @@ Write out the current server config as YAML to stdout.`,
23332333
Value: &c.Notifications.StoreSyncInterval,
23342334
Default: (time.Second * 2).String(),
23352335
Group: &deploymentGroupNotifications,
2336-
YAML: "store-sync-interval",
2336+
YAML: "storeSyncInterval",
23372337
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
23382338
Hidden: true, // Hidden because most operators should not need to modify this.
23392339
},
@@ -2348,7 +2348,7 @@ Write out the current server config as YAML to stdout.`,
23482348
Value: &c.Notifications.StoreSyncBufferSize,
23492349
Default: "50",
23502350
Group: &deploymentGroupNotifications,
2351-
YAML: "store-sync-buffer-size",
2351+
YAML: "storeSyncBufferSize",
23522352
Hidden: true, // Hidden because most operators should not need to modify this.
23532353
},
23542354
{
@@ -2363,7 +2363,7 @@ Write out the current server config as YAML to stdout.`,
23632363
Value: &c.Notifications.LeasePeriod,
23642364
Default: (time.Minute * 2).String(),
23652365
Group: &deploymentGroupNotifications,
2366-
YAML: "lease-period",
2366+
YAML: "leasePeriod",
23672367
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
23682368
Hidden: true, // Hidden because most operators should not need to modify this.
23692369
},
@@ -2375,7 +2375,7 @@ Write out the current server config as YAML to stdout.`,
23752375
Value: &c.Notifications.LeaseCount,
23762376
Default: "20",
23772377
Group: &deploymentGroupNotifications,
2378-
YAML: "lease-count",
2378+
YAML: "leaseCount",
23792379
Hidden: true, // Hidden because most operators should not need to modify this.
23802380
},
23812381
{
@@ -2386,7 +2386,7 @@ Write out the current server config as YAML to stdout.`,
23862386
Value: &c.Notifications.FetchInterval,
23872387
Default: (time.Second * 15).String(),
23882388
Group: &deploymentGroupNotifications,
2389-
YAML: "fetch-interval",
2389+
YAML: "fetchInterval",
23902390
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
23912391
Hidden: true, // Hidden because most operators should not need to modify this.
23922392
},

0 commit comments

Comments
 (0)