Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 823a2ea

Browse files
chore(cli): drop 'notification' prefix for configuring email auth (#15270)
Closes #14644
1 parent 2573838 commit 823a2ea

File tree

8 files changed

+536
-45
lines changed

8 files changed

+536
-45
lines changed

cli/testdata/coder_server_--help.golden

+69-3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,58 @@ Use a YAML configuration file when your server launch become unwieldy.
106106

107107
Write out the current server config as YAML to stdout.
108108

109+
EMAIL OPTIONS:
110+
Configure how emails are sent.
111+
112+
--email-force-tls bool, $CODER_EMAIL_FORCE_TLS (default: false)
113+
Force a TLS connection to the configured SMTP smarthost.
114+
115+
--email-from string, $CODER_EMAIL_FROM
116+
The sender's address to use.
117+
118+
--email-hello string, $CODER_EMAIL_HELLO (default: localhost)
119+
The hostname identifying the SMTP server.
120+
121+
--email-smarthost host:port, $CODER_EMAIL_SMARTHOST (default: localhost:587)
122+
The intermediary SMTP host through which emails are sent.
123+
124+
EMAIL / EMAIL AUTHENTICATION OPTIONS:
125+
Configure SMTP authentication options.
126+
127+
--email-auth-identity string, $CODER_EMAIL_AUTH_IDENTITY
128+
Identity to use with PLAIN authentication.
129+
130+
--email-auth-password string, $CODER_EMAIL_AUTH_PASSWORD
131+
Password to use with PLAIN/LOGIN authentication.
132+
133+
--email-auth-password-file string, $CODER_EMAIL_AUTH_PASSWORD_FILE
134+
File from which to load password for use with PLAIN/LOGIN
135+
authentication.
136+
137+
--email-auth-username string, $CODER_EMAIL_AUTH_USERNAME
138+
Username to use with PLAIN/LOGIN authentication.
139+
140+
EMAIL / EMAIL TLS OPTIONS:
141+
Configure TLS for your SMTP server target.
142+
143+
--email-tls-ca-cert-file string, $CODER_EMAIL_TLS_CACERTFILE
144+
CA certificate file to use.
145+
146+
--email-tls-cert-file string, $CODER_EMAIL_TLS_CERTFILE
147+
Certificate file to use.
148+
149+
--email-tls-cert-key-file string, $CODER_EMAIL_TLS_CERTKEYFILE
150+
Certificate key file to use.
151+
152+
--email-tls-server-name string, $CODER_EMAIL_TLS_SERVERNAME
153+
Server name to verify against the target certificate.
154+
155+
--email-tls-skip-verify bool, $CODER_EMAIL_TLS_SKIPVERIFY
156+
Skip verification of the target server's certificate (insecure).
157+
158+
--email-tls-starttls bool, $CODER_EMAIL_TLS_STARTTLS
159+
Enable STARTTLS to upgrade insecure SMTP connections using TLS.
160+
109161
INTROSPECTION / HEALTH CHECK OPTIONS:
110162
--health-check-refresh duration, $CODER_HEALTH_CHECK_REFRESH (default: 10m0s)
111163
Refresh interval for healthchecks.
@@ -349,54 +401,68 @@ Configure how notifications are processed and delivered.
349401
NOTIFICATIONS / EMAIL OPTIONS:
350402
Configure how email notifications are sent.
351403

352-
--notifications-email-force-tls bool, $CODER_NOTIFICATIONS_EMAIL_FORCE_TLS (default: false)
404+
--notifications-email-force-tls bool, $CODER_NOTIFICATIONS_EMAIL_FORCE_TLS
353405
Force a TLS connection to the configured SMTP smarthost.
406+
DEPRECATED: Use --email-force-tls instead.
354407

355408
--notifications-email-from string, $CODER_NOTIFICATIONS_EMAIL_FROM
356409
The sender's address to use.
410+
DEPRECATED: Use --email-from instead.
357411

358-
--notifications-email-hello string, $CODER_NOTIFICATIONS_EMAIL_HELLO (default: localhost)
412+
--notifications-email-hello string, $CODER_NOTIFICATIONS_EMAIL_HELLO
359413
The hostname identifying the SMTP server.
414+
DEPRECATED: Use --email-hello instead.
360415

361-
--notifications-email-smarthost host:port, $CODER_NOTIFICATIONS_EMAIL_SMARTHOST (default: localhost:587)
416+
--notifications-email-smarthost host:port, $CODER_NOTIFICATIONS_EMAIL_SMARTHOST
362417
The intermediary SMTP host through which emails are sent.
418+
DEPRECATED: Use --email-smarthost instead.
363419

364420
NOTIFICATIONS / EMAIL / EMAIL AUTHENTICATION OPTIONS:
365421
Configure SMTP authentication options.
366422

367423
--notifications-email-auth-identity string, $CODER_NOTIFICATIONS_EMAIL_AUTH_IDENTITY
368424
Identity to use with PLAIN authentication.
425+
DEPRECATED: Use --email-auth-identity instead.
369426

370427
--notifications-email-auth-password string, $CODER_NOTIFICATIONS_EMAIL_AUTH_PASSWORD
371428
Password to use with PLAIN/LOGIN authentication.
429+
DEPRECATED: Use --email-auth-password instead.
372430

373431
--notifications-email-auth-password-file string, $CODER_NOTIFICATIONS_EMAIL_AUTH_PASSWORD_FILE
374432
File from which to load password for use with PLAIN/LOGIN
375433
authentication.
434+
DEPRECATED: Use --email-auth-password-file instead.
376435

377436
--notifications-email-auth-username string, $CODER_NOTIFICATIONS_EMAIL_AUTH_USERNAME
378437
Username to use with PLAIN/LOGIN authentication.
438+
DEPRECATED: Use --email-auth-username instead.
379439

380440
NOTIFICATIONS / EMAIL / EMAIL TLS OPTIONS:
381441
Configure TLS for your SMTP server target.
382442

383443
--notifications-email-tls-ca-cert-file string, $CODER_NOTIFICATIONS_EMAIL_TLS_CACERTFILE
384444
CA certificate file to use.
445+
DEPRECATED: Use --email-tls-ca-cert-file instead.
385446

386447
--notifications-email-tls-cert-file string, $CODER_NOTIFICATIONS_EMAIL_TLS_CERTFILE
387448
Certificate file to use.
449+
DEPRECATED: Use --email-tls-cert-file instead.
388450

389451
--notifications-email-tls-cert-key-file string, $CODER_NOTIFICATIONS_EMAIL_TLS_CERTKEYFILE
390452
Certificate key file to use.
453+
DEPRECATED: Use --email-tls-cert-key-file instead.
391454

392455
--notifications-email-tls-server-name string, $CODER_NOTIFICATIONS_EMAIL_TLS_SERVERNAME
393456
Server name to verify against the target certificate.
457+
DEPRECATED: Use --email-tls-server-name instead.
394458

395459
--notifications-email-tls-skip-verify bool, $CODER_NOTIFICATIONS_EMAIL_TLS_SKIPVERIFY
396460
Skip verification of the target server's certificate (insecure).
461+
DEPRECATED: Use --email-tls-skip-verify instead.
397462

398463
--notifications-email-tls-starttls bool, $CODER_NOTIFICATIONS_EMAIL_TLS_STARTTLS
399464
Enable STARTTLS to upgrade insecure SMTP connections using TLS.
465+
DEPRECATED: Use --email-tls-starttls instead.
400466

401467
NOTIFICATIONS / WEBHOOK OPTIONS:
402468
--notifications-webhook-endpoint url, $CODER_NOTIFICATIONS_WEBHOOK_ENDPOINT

cli/testdata/server-config.yaml.golden

+48-3
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,51 @@ userQuietHoursSchedule:
518518
# compatibility reasons, this will be removed in a future release.
519519
# (default: false, type: bool)
520520
allowWorkspaceRenames: false
521+
# Configure how emails are sent.
522+
email:
523+
# The sender's address to use.
524+
# (default: <unset>, type: string)
525+
from: ""
526+
# The intermediary SMTP host through which emails are sent.
527+
# (default: localhost:587, type: host:port)
528+
smarthost: localhost:587
529+
# The hostname identifying the SMTP server.
530+
# (default: localhost, type: string)
531+
hello: localhost
532+
# Force a TLS connection to the configured SMTP smarthost.
533+
# (default: false, type: bool)
534+
forceTLS: false
535+
# Configure SMTP authentication options.
536+
emailAuth:
537+
# Identity to use with PLAIN authentication.
538+
# (default: <unset>, type: string)
539+
identity: ""
540+
# Username to use with PLAIN/LOGIN authentication.
541+
# (default: <unset>, type: string)
542+
username: ""
543+
# File from which to load password for use with PLAIN/LOGIN authentication.
544+
# (default: <unset>, type: string)
545+
passwordFile: ""
546+
# Configure TLS for your SMTP server target.
547+
emailTLS:
548+
# Enable STARTTLS to upgrade insecure SMTP connections using TLS.
549+
# (default: <unset>, type: bool)
550+
startTLS: false
551+
# Server name to verify against the target certificate.
552+
# (default: <unset>, type: string)
553+
serverName: ""
554+
# Skip verification of the target server's certificate (insecure).
555+
# (default: <unset>, type: bool)
556+
insecureSkipVerify: false
557+
# CA certificate file to use.
558+
# (default: <unset>, type: string)
559+
caCertFile: ""
560+
# Certificate file to use.
561+
# (default: <unset>, type: string)
562+
certFile: ""
563+
# Certificate key file to use.
564+
# (default: <unset>, type: string)
565+
certKeyFile: ""
521566
# Configure how notifications are processed and delivered.
522567
notifications:
523568
# Which delivery method to use (available options: 'smtp', 'webhook').
@@ -532,13 +577,13 @@ notifications:
532577
# (default: <unset>, type: string)
533578
from: ""
534579
# The intermediary SMTP host through which emails are sent.
535-
# (default: localhost:587, type: host:port)
580+
# (default: <unset>, type: host:port)
536581
smarthost: localhost:587
537582
# The hostname identifying the SMTP server.
538-
# (default: localhost, type: string)
583+
# (default: <unset>, type: string)
539584
hello: localhost
540585
# Force a TLS connection to the configured SMTP smarthost.
541-
# (default: false, type: bool)
586+
# (default: <unset>, type: bool)
542587
forceTLS: false
543588
# Configure SMTP authentication options.
544589
emailAuth:

coderd/notifications/dispatch/smtp.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ func (s *SMTPHandler) auth(ctx context.Context, mechs string) (sasl.Client, erro
453453
continue
454454
}
455455
if password == "" {
456-
errs = multierror.Append(errs, xerrors.New("cannot use PLAIN auth, password not defined (see CODER_NOTIFICATIONS_EMAIL_AUTH_PASSWORD)"))
456+
errs = multierror.Append(errs, xerrors.New("cannot use PLAIN auth, password not defined (see CODER_EMAIL_AUTH_PASSWORD)"))
457457
continue
458458
}
459459

@@ -475,7 +475,7 @@ func (s *SMTPHandler) auth(ctx context.Context, mechs string) (sasl.Client, erro
475475
continue
476476
}
477477
if password == "" {
478-
errs = multierror.Append(errs, xerrors.New("cannot use LOGIN auth, password not defined (see CODER_NOTIFICATIONS_EMAIL_AUTH_PASSWORD)"))
478+
errs = multierror.Append(errs, xerrors.New("cannot use LOGIN auth, password not defined (see CODER_EMAIL_AUTH_PASSWORD)"))
479479
continue
480480
}
481481

0 commit comments

Comments
 (0)