Skip to content

Commit 2410cd9

Browse files
committed
replaced str by EmailStr because SQLModel supports it since version 0.0.19:
https://sqlmodel.tiangolo.com/release-notes/#0019
1 parent f178e58 commit 2410cd9

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

backend/app/core/config.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
PostgresDsn,
1010
computed_field,
1111
model_validator,
12+
EmailStr,
1213
)
1314
from pydantic_core import MultiHostUrl
1415
from pydantic_settings import BaseSettings, SettingsConfigDict
@@ -37,9 +38,9 @@ class Settings(BaseSettings):
3738
FRONTEND_HOST: str = "http://localhost:5173"
3839
ENVIRONMENT: Literal["local", "staging", "production"] = "local"
3940

40-
BACKEND_CORS_ORIGINS: Annotated[
41-
list[AnyUrl] | str, BeforeValidator(parse_cors)
42-
] = []
41+
BACKEND_CORS_ORIGINS: Annotated[list[AnyUrl] | str, BeforeValidator(parse_cors)] = (
42+
[]
43+
)
4344

4445
@computed_field # type: ignore[prop-decorator]
4546
@property
@@ -74,9 +75,8 @@ def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn:
7475
SMTP_HOST: str | None = None
7576
SMTP_USER: str | None = None
7677
SMTP_PASSWORD: str | None = None
77-
# TODO: update type to EmailStr when sqlmodel supports it
78-
EMAILS_FROM_EMAIL: str | None = None
79-
EMAILS_FROM_NAME: str | None = None
78+
EMAILS_FROM_EMAIL: EmailStr | None = None
79+
EMAILS_FROM_NAME: EmailStr | None = None
8080

8181
@model_validator(mode="after")
8282
def _set_default_emails_from(self) -> Self:
@@ -91,10 +91,8 @@ def _set_default_emails_from(self) -> Self:
9191
def emails_enabled(self) -> bool:
9292
return bool(self.SMTP_HOST and self.EMAILS_FROM_EMAIL)
9393

94-
# TODO: update type to EmailStr when sqlmodel supports it
95-
EMAIL_TEST_USER: str = "[email protected]"
96-
# TODO: update type to EmailStr when sqlmodel supports it
97-
FIRST_SUPERUSER: str
94+
EMAIL_TEST_USER: EmailStr = "[email protected]"
95+
FIRST_SUPERUSER: EmailStr
9896
FIRST_SUPERUSER_PASSWORD: str
9997

10098
def _check_default_secret(self, var_name: str, value: str | None) -> None:

0 commit comments

Comments
 (0)