Skip to content
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

Merged
merged 11 commits into from
Nov 21, 2024
Merged

Conversation

scotttrinh
Copy link
Contributor

This will provide multiple choices for email providers allowing switching
between providers. Moves the SMTP config into the main config namespace to allow for instance-wide configuration.

@msullivan
Copy link
Member

Yeah, this is what I was thinking of basically.

@scotttrinh scotttrinh force-pushed the email-provider branch 4 times, most recently from 02628d1 to e34724d Compare November 6, 2024 17:52
Comment on lines +121 to +122
"EDGEDB_SERVER_AUTH_SMTP_CONCURRENCY",
os.environ.get("EDGEDB_SERVER_SMTP_CONCURRENCY", 5),
Copy link
Contributor Author

@scotttrinh scotttrinh Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt? I guess we need GEL stuff, too...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this not go through the config system somehow?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess "probably, but also the existing behavior doesn't"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, now is a great time to add it to the config!

@scotttrinh scotttrinh marked this pull request as ready for review November 7, 2024 12:22
Copy link
Contributor Author

@scotttrinh scotttrinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes to self after a quick self-review.

};

CREATE TYPE cfg::SMTPProviderConfig EXTENDING cfg::EmailProviderConfig {
CREATE PROPERTY sender -> std::str {
Copy link
Contributor Author

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.

SET default := <std::duration>'15 seconds';
CREATE ANNOTATION std::description :=
"Maximum time for each SMTP request.";
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Max concurrency config here?

Copy link
Member

Choose a reason for hiding this comment

The 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.

This will provide multiple choices for email providers allowing switching
between providers.
Providers need to be set up per-instance to allow instance-wide fallback
to a configured provider.
msullivan and others added 5 commits November 8, 2024 12:02
This lets old SMTP config work when restoring dumps
Configure with something like:
```
EDGEDB_MAGIC_SMTP_CONFIG='[{"_tname": "cfg::SMTPProviderConfig", "validate_certs": true, "host": null, "password": null, "name": "cloud_dev_smtp", "port": null, "security": "STARTTLSOrPlainText", "username": null, "sender": "[email protected]", "timeout_per_email": "PT1M", "timeout_per_attempt": "PT15S"}]'
```
@@ -1282,6 +1283,20 @@ def get_default_tenant(self) -> edbtenant.Tenant:
def iter_tenants(self) -> Iterator[edbtenant.Tenant]:
yield self._tenant

def _load_sidechannel_configs(self) -> None:
# TODO(fantix): Do something like this for multitenant
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Copy link
Member

@msullivan msullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good from my side; not sure if @fantix wants to take a deeper look too

Copy link
Member

@fantix fantix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@msullivan
Copy link
Member

Anything blocking this?

@scotttrinh scotttrinh merged commit c037ac1 into master Nov 21, 2024
23 checks passed
@scotttrinh scotttrinh deleted the email-provider branch November 21, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants