Move from_address to domain options with no-reply default
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
nemunaire 2026-05-21 18:35:42 +08:00
commit 10a65aed02
2 changed files with 11 additions and 8 deletions

View file

@ -158,7 +158,11 @@ func loadConfig(opts sdk.CheckerOptions) (*runConfig, error) {
return nil, fmt.Errorf("smtp_host is required")
}
if cfg.FromAddress == "" {
return nil, fmt.Errorf("from_address is required")
domain := strings.TrimSpace(stringOpt(opts, "domain_name"))
if domain == "" {
return nil, fmt.Errorf("from_address is required when domain_name is not set")
}
cfg.FromAddress = "no-reply@" + strings.TrimSuffix(domain, ".")
}
parsedFrom, err := mail.ParseAddress(cfg.FromAddress)
if err != nil {

View file

@ -71,13 +71,6 @@ func Definition() *sdk.CheckerDefinition {
Choices: []string{"starttls", "tls", "none"},
Default: "starttls",
},
{
Id: "from_address",
Type: "string",
Label: "From address",
Description: "Address used in the From header of the test email. Must be in the tested domain.",
Required: true,
},
{
Id: "subject_override",
Type: "string",
@ -119,6 +112,12 @@ func Definition() *sdk.CheckerDefinition {
Label: "Domain name",
AutoFill: sdk.AutoFillDomainName,
},
{
Id: "from_address",
Type: "string",
Label: "From address",
Description: "Address used in the From header of the test email. Must be in the tested domain. Defaults to no-reply@<domain>.",
},
},
},
Rules: []sdk.CheckRule{