1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-07-17 01:32:33 +02:00

Deprecate environment MP_STRICT_RFC_HEADERS => MP_SMTP_STRICT_RFC_HEADERS

This commit is contained in:
Ralph Slooten
2023-12-10 15:04:17 +13:00
parent 28cd1fceee
commit f69106a67a

View File

@ -2,7 +2,6 @@
package cmd package cmd
import ( import (
"fmt"
"os" "os"
"strconv" "strconv"
"strings" "strings"
@ -164,7 +163,7 @@ func initConfigFromEnv() {
if getEnabledFromEnv("MP_SMTP_AUTH_ALLOW_INSECURE") { if getEnabledFromEnv("MP_SMTP_AUTH_ALLOW_INSECURE") {
config.SMTPAuthAllowInsecure = true config.SMTPAuthAllowInsecure = true
} }
if getEnabledFromEnv("MP_STRICT_RFC_HEADERS") { if getEnabledFromEnv("MP_SMTP_STRICT_RFC_HEADERS") {
config.SMTPStrictRFCHeaders = true config.SMTPStrictRFCHeaders = true
} }
@ -216,24 +215,29 @@ func initConfigFromEnv() {
func initDeprecatedConfigFromEnv() { func initDeprecatedConfigFromEnv() {
// deprecated 2023/03/12 // deprecated 2023/03/12
if len(os.Getenv("MP_UI_SSL_CERT")) > 0 { if len(os.Getenv("MP_UI_SSL_CERT")) > 0 {
fmt.Println("ENV MP_UI_SSL_CERT has been deprecated, use MP_UI_TLS_CERT") logger.Log().Warn("ENV MP_UI_SSL_CERT has been deprecated, use MP_UI_TLS_CERT")
config.UITLSCert = os.Getenv("MP_UI_SSL_CERT") config.UITLSCert = os.Getenv("MP_UI_SSL_CERT")
} }
// deprecated 2023/03/12 // deprecated 2023/03/12
if len(os.Getenv("MP_UI_SSL_KEY")) > 0 { if len(os.Getenv("MP_UI_SSL_KEY")) > 0 {
fmt.Println("ENV MP_UI_SSL_KEY has been deprecated, use MP_UI_TLS_KEY") logger.Log().Warn("ENV MP_UI_SSL_KEY has been deprecated, use MP_UI_TLS_KEY")
config.UITLSKey = os.Getenv("MP_UI_SSL_KEY") config.UITLSKey = os.Getenv("MP_UI_SSL_KEY")
} }
// deprecated 2023/03/12 // deprecated 2023/03/12
if len(os.Getenv("MP_SMTP_SSL_CERT")) > 0 { if len(os.Getenv("MP_SMTP_SSL_CERT")) > 0 {
fmt.Println("ENV MP_SMTP_CERT has been deprecated, use MP_SMTP_TLS_CERT") logger.Log().Warn("ENV MP_SMTP_CERT has been deprecated, use MP_SMTP_TLS_CERT")
config.SMTPTLSCert = os.Getenv("MP_SMTP_SSL_CERT") config.SMTPTLSCert = os.Getenv("MP_SMTP_SSL_CERT")
} }
// deprecated 2023/03/12 // deprecated 2023/03/12
if len(os.Getenv("MP_SMTP_SSL_KEY")) > 0 { if len(os.Getenv("MP_SMTP_SSL_KEY")) > 0 {
fmt.Println("ENV MP_SMTP_KEY has been deprecated, use MP_SMTP_TLS_KEY") logger.Log().Warn("ENV MP_SMTP_KEY has been deprecated, use MP_SMTP_TLS_KEY")
config.SMTPTLSKey = os.Getenv("MP_SMTP_SMTP_KEY") config.SMTPTLSKey = os.Getenv("MP_SMTP_SMTP_KEY")
} }
// deprecated 2023/12/10
if getEnabledFromEnv("MP_STRICT_RFC_HEADERS") {
logger.Log().Warn("ENV MP_STRICT_RFC_HEADERS has been deprecated, use MP_SMTP_STRICT_RFC_HEADERS")
config.SMTPStrictRFCHeaders = true
}
} }
// Wrapper to get a boolean from an environment variable // Wrapper to get a boolean from an environment variable