2019-04-25 04:52:08 +07:00
|
|
|
package schema
|
|
|
|
|
2021-11-30 18:15:21 +07:00
|
|
|
import (
|
|
|
|
"net/mail"
|
|
|
|
"time"
|
|
|
|
)
|
2021-08-10 07:52:41 +07:00
|
|
|
|
2019-04-25 04:52:08 +07:00
|
|
|
// FileSystemNotifierConfiguration represents the configuration of the notifier writing emails in a file.
|
|
|
|
type FileSystemNotifierConfiguration struct {
|
2021-08-03 16:55:21 +07:00
|
|
|
Filename string `koanf:"filename"`
|
2019-04-25 04:52:08 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
// SMTPNotifierConfiguration represents the configuration of the SMTP server to send emails with.
|
|
|
|
type SMTPNotifierConfiguration struct {
|
2021-08-10 07:52:41 +07:00
|
|
|
Host string `koanf:"host"`
|
|
|
|
Port int `koanf:"port"`
|
|
|
|
Timeout time.Duration `koanf:"timeout"`
|
|
|
|
Username string `koanf:"username"`
|
|
|
|
Password string `koanf:"password"`
|
|
|
|
Identifier string `koanf:"identifier"`
|
2021-11-30 18:15:21 +07:00
|
|
|
Sender mail.Address `koanf:"sender"`
|
2021-08-10 07:52:41 +07:00
|
|
|
Subject string `koanf:"subject"`
|
|
|
|
StartupCheckAddress string `koanf:"startup_check_address"`
|
|
|
|
DisableRequireTLS bool `koanf:"disable_require_tls"`
|
|
|
|
DisableHTMLEmails bool `koanf:"disable_html_emails"`
|
|
|
|
TLS *TLSConfig `koanf:"tls"`
|
2019-04-25 04:52:08 +07:00
|
|
|
}
|
|
|
|
|
2020-01-06 06:03:16 +07:00
|
|
|
// NotifierConfiguration represents the configuration of the notifier to use when sending notifications to users.
|
2019-04-25 04:52:08 +07:00
|
|
|
type NotifierConfiguration struct {
|
2021-08-03 16:55:21 +07:00
|
|
|
DisableStartupCheck bool `koanf:"disable_startup_check"`
|
|
|
|
FileSystem *FileSystemNotifierConfiguration `koanf:"filesystem"`
|
|
|
|
SMTP *SMTPNotifierConfiguration `koanf:"smtp"`
|
2019-04-25 04:52:08 +07:00
|
|
|
}
|
2020-04-09 07:21:28 +07:00
|
|
|
|
2020-04-21 04:03:38 +07:00
|
|
|
// DefaultSMTPNotifierConfiguration represents default configuration parameters for the SMTP notifier.
|
2020-04-09 07:21:28 +07:00
|
|
|
var DefaultSMTPNotifierConfiguration = SMTPNotifierConfiguration{
|
2021-11-30 18:15:21 +07:00
|
|
|
Timeout: time.Second * 5,
|
|
|
|
Subject: "[Authelia] {title}",
|
|
|
|
Identifier: "localhost",
|
|
|
|
StartupCheckAddress: "test@authelia.com",
|
2021-01-04 17:28:55 +07:00
|
|
|
TLS: &TLSConfig{
|
|
|
|
MinimumVersion: "TLS1.2",
|
|
|
|
},
|
2020-04-09 07:21:28 +07:00
|
|
|
}
|