2019-04-24 21:52:08 +00:00
|
|
|
package schema
|
|
|
|
|
2021-11-30 11:15:21 +00:00
|
|
|
import (
|
2022-10-21 08:41:33 +00:00
|
|
|
"crypto/tls"
|
2021-11-30 11:15:21 +00:00
|
|
|
"net/mail"
|
2023-05-07 06:39:17 +00:00
|
|
|
"net/url"
|
2021-11-30 11:15:21 +00:00
|
|
|
"time"
|
|
|
|
)
|
2021-08-10 00:52:41 +00:00
|
|
|
|
2019-04-24 21:52:08 +00:00
|
|
|
// FileSystemNotifierConfiguration represents the configuration of the notifier writing emails in a file.
|
|
|
|
type FileSystemNotifierConfiguration struct {
|
2021-08-03 09:55:21 +00:00
|
|
|
Filename string `koanf:"filename"`
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SMTPNotifierConfiguration represents the configuration of the SMTP server to send emails with.
|
|
|
|
type SMTPNotifierConfiguration struct {
|
2023-05-07 06:39:17 +00:00
|
|
|
Address *AddressSMTP `koanf:"address"`
|
2021-08-10 00:52:41 +00:00
|
|
|
Timeout time.Duration `koanf:"timeout"`
|
|
|
|
Username string `koanf:"username"`
|
|
|
|
Password string `koanf:"password"`
|
|
|
|
Identifier string `koanf:"identifier"`
|
2021-11-30 11:15:21 +00:00
|
|
|
Sender mail.Address `koanf:"sender"`
|
2021-08-10 00:52:41 +00:00
|
|
|
Subject string `koanf:"subject"`
|
2022-07-18 00:56:09 +00:00
|
|
|
StartupCheckAddress mail.Address `koanf:"startup_check_address"`
|
2021-08-10 00:52:41 +00:00
|
|
|
DisableRequireTLS bool `koanf:"disable_require_tls"`
|
|
|
|
DisableHTMLEmails bool `koanf:"disable_html_emails"`
|
2022-10-02 02:51:19 +00:00
|
|
|
DisableStartTLS bool `koanf:"disable_starttls"`
|
2021-08-10 00:52:41 +00:00
|
|
|
TLS *TLSConfig `koanf:"tls"`
|
2023-05-07 06:39:17 +00:00
|
|
|
|
|
|
|
// Deprecated: use address instead.
|
|
|
|
Host string `koanf:"host"`
|
|
|
|
|
|
|
|
// Deprecated: use address instead.
|
|
|
|
Port int `koanf:"port"`
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
|
|
|
|
2020-01-05 23:03:16 +00:00
|
|
|
// NotifierConfiguration represents the configuration of the notifier to use when sending notifications to users.
|
2019-04-24 21:52:08 +00:00
|
|
|
type NotifierConfiguration struct {
|
2021-08-03 09:55:21 +00:00
|
|
|
DisableStartupCheck bool `koanf:"disable_startup_check"`
|
|
|
|
FileSystem *FileSystemNotifierConfiguration `koanf:"filesystem"`
|
|
|
|
SMTP *SMTPNotifierConfiguration `koanf:"smtp"`
|
2022-04-03 12:24:51 +00:00
|
|
|
TemplatePath string `koanf:"template_path"`
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
2020-04-09 00:21:28 +00:00
|
|
|
|
2020-04-20 21:03:38 +00:00
|
|
|
// DefaultSMTPNotifierConfiguration represents default configuration parameters for the SMTP notifier.
|
2020-04-09 00:21:28 +00:00
|
|
|
var DefaultSMTPNotifierConfiguration = SMTPNotifierConfiguration{
|
2023-05-07 06:39:17 +00:00
|
|
|
Address: &AddressSMTP{Address{true, false, 25, &url.URL{Scheme: AddressSchemeSMTP, Host: "localhost:25"}}},
|
2021-11-30 11:15:21 +00:00
|
|
|
Timeout: time.Second * 5,
|
|
|
|
Subject: "[Authelia] {title}",
|
|
|
|
Identifier: "localhost",
|
2022-07-18 00:56:09 +00:00
|
|
|
StartupCheckAddress: mail.Address{Name: "Authelia Test", Address: "test@authelia.com"},
|
2021-01-04 10:28:55 +00:00
|
|
|
TLS: &TLSConfig{
|
2022-10-21 08:41:33 +00:00
|
|
|
MinimumVersion: TLSVersion{tls.VersionTLS12},
|
2021-01-04 10:28:55 +00:00
|
|
|
},
|
2020-04-09 00:21:28 +00:00
|
|
|
}
|