Coverage for src/core/settings.py: 100%

1 from pydantic import Field

2 from pydantic_settings import BaseSettings

3

4

5 class MailSettings(BaseSettings):

6 host: str = Field(default="smtp.yandex.com")

7 port: int = Field(default=587)

8 login: str = Field(default="info@service-laboratory.online")

9 password: str = Field(default="superPassword")

10

11 class Config:

12 env_prefix = "MAIL_"

13

14

15 class OpenApiSettings(BaseSettings):

16 title: str = Field(deafult="title")

17 version: str = Field(deafult="0.1.2")

18 path: str = Field(deafult="/api/docs")

19

20 class Config:

21 env_prefix = "OPEN_API_"

22

23

24 class Settings(BaseSettings):

25 db_url: str = Field(default="postgresql+asyncpg://user:password@localhost:5432/db")

26 jwt_secret: str = Field(default="secret_for_jwt")

27 open_api_config: OpenApiSettings = Field(default_factory=OpenApiSettings)

28 mail_config: MailSettings = Field(default_factory=MailSettings)

29

30

31 settings = Settings()