Implement TimeZone in settings
This commit is contained in:
2
.env
2
.env
@@ -38,6 +38,8 @@ POSTGRES_DB=app
|
|||||||
POSTGRES_USER=postgres
|
POSTGRES_USER=postgres
|
||||||
POSTGRES_PASSWORD=changethis
|
POSTGRES_PASSWORD=changethis
|
||||||
|
|
||||||
|
TZ=UTC
|
||||||
|
|
||||||
SENTRY_DSN=
|
SENTRY_DSN=
|
||||||
|
|
||||||
# Configure these with your own Docker registry images
|
# Configure these with your own Docker registry images
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from pydantic import (
|
|||||||
from pydantic_core import MultiHostUrl
|
from pydantic_core import MultiHostUrl
|
||||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
|
|
||||||
def parse_cors(v: Any) -> list[str] | str:
|
def parse_cors(v: Any) -> list[str] | str:
|
||||||
@@ -69,6 +70,12 @@ class Settings(BaseSettings):
|
|||||||
path=self.POSTGRES_DB,
|
path=self.POSTGRES_DB,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
tz: str = "UTC"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def tz_info(self):
|
||||||
|
return ZoneInfo(self.tz)
|
||||||
|
|
||||||
SMTP_TLS: bool = True
|
SMTP_TLS: bool = True
|
||||||
SMTP_SSL: bool = False
|
SMTP_SSL: bool = False
|
||||||
SMTP_PORT: int = 587
|
SMTP_PORT: int = 587
|
||||||
|
|||||||
Reference in New Issue
Block a user