-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate ext::auth::SMTPConfig
-> cfg::EmailProvider
#7942
Changes from all commits
460971f
1c07815
623c2d1
57fe0bc
df5a071
3121c31
381d3e9
8c06f01
08c444a
3f8e89d
a7303bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,71 @@ CREATE TYPE cfg::Auth EXTENDING cfg::ConfigObject { | |
}; | ||
}; | ||
|
||
CREATE SCALAR TYPE cfg::SMTPSecurity EXTENDING enum< | ||
PlainText, | ||
TLS, | ||
STARTTLS, | ||
STARTTLSOrPlainText, | ||
>; | ||
|
||
CREATE ABSTRACT TYPE cfg::EmailProviderConfig EXTENDING cfg::ConfigObject { | ||
CREATE REQUIRED PROPERTY name -> std::str { | ||
CREATE CONSTRAINT std::exclusive; | ||
CREATE ANNOTATION std::description := | ||
"The name of the email provider."; | ||
}; | ||
}; | ||
|
||
CREATE TYPE cfg::SMTPProviderConfig EXTENDING cfg::EmailProviderConfig { | ||
CREATE PROPERTY sender -> std::str { | ||
CREATE ANNOTATION std::description := | ||
"\"From\" address of system emails sent for e.g. \ | ||
password reset, etc."; | ||
}; | ||
CREATE PROPERTY host -> std::str { | ||
CREATE ANNOTATION std::description := | ||
"Host of SMTP server to use for sending emails. \ | ||
If not set, \"localhost\" will be used."; | ||
}; | ||
CREATE PROPERTY port -> std::int32 { | ||
CREATE ANNOTATION std::description := | ||
"Port of SMTP server to use for sending emails. \ | ||
If not set, common defaults will be used depending on security: \ | ||
465 for TLS, 587 for STARTTLS, 25 otherwise."; | ||
}; | ||
CREATE PROPERTY username -> std::str { | ||
CREATE ANNOTATION std::description := | ||
"Username to login as after connected to SMTP server."; | ||
}; | ||
CREATE PROPERTY password -> std::str { | ||
SET secret := true; | ||
CREATE ANNOTATION std::description := | ||
"Password for login after connected to SMTP server."; | ||
}; | ||
CREATE REQUIRED PROPERTY security -> cfg::SMTPSecurity { | ||
SET default := cfg::SMTPSecurity.STARTTLSOrPlainText; | ||
CREATE ANNOTATION std::description := | ||
"Security mode of the connection to SMTP server. \ | ||
By default, initiate a STARTTLS upgrade if supported by the \ | ||
server, or fallback to PlainText."; | ||
}; | ||
CREATE REQUIRED PROPERTY validate_certs -> std::bool { | ||
SET default := true; | ||
CREATE ANNOTATION std::description := | ||
"Determines if SMTP server certificates are validated."; | ||
}; | ||
CREATE REQUIRED PROPERTY timeout_per_email -> std::duration { | ||
SET default := <std::duration>'60 seconds'; | ||
CREATE ANNOTATION std::description := | ||
"Maximum time to send an email, including retry attempts."; | ||
}; | ||
CREATE REQUIRED PROPERTY timeout_per_attempt -> std::duration { | ||
SET default := <std::duration>'15 seconds'; | ||
CREATE ANNOTATION std::description := | ||
"Maximum time for each SMTP request."; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Max concurrency config here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think so. Though this would become a per-provider config, instead of a server/tenant-wide config. It should be fine for now, but in the long run we may want to have both: per-provider config makes sure of not overwhelming the provider, while the server/tenant-wide config makes sure e.g. the local number of FDs is not exceeded. |
||
}; | ||
|
||
CREATE ABSTRACT TYPE cfg::AbstractConfig extending cfg::ConfigObject; | ||
|
||
CREATE ABSTRACT TYPE cfg::ExtensionConfig EXTENDING cfg::ConfigObject { | ||
|
@@ -158,6 +223,16 @@ ALTER TYPE cfg::AbstractConfig { | |
CREATE ANNOTATION cfg::system := 'true'; | ||
}; | ||
|
||
CREATE MULTI LINK email_providers -> cfg::EmailProviderConfig { | ||
CREATE ANNOTATION std::description := | ||
'The list of email providers that can be used to send emails.'; | ||
}; | ||
|
||
CREATE PROPERTY current_email_provider_name -> std::str { | ||
CREATE ANNOTATION std::description := | ||
'The name of the current email provider.'; | ||
}; | ||
|
||
CREATE PROPERTY allow_dml_in_functions -> std::bool { | ||
SET default := false; | ||
CREATE ANNOTATION cfg::affects_compilation := 'true'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make
sender
required, I'm not sure why we didn't have that before.