28 lines
773 B
Python
28 lines
773 B
Python
"""Конфигурация приложения."""
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Настройки из переменных окружения."""
|
|
|
|
postgres_host: str = "db"
|
|
postgres_port: int = 5432
|
|
postgres_db: str = "lms_it_oms"
|
|
postgres_user: str = "lms"
|
|
postgres_password: str = ""
|
|
content_path: str = "" # Путь к каталогу content (в Docker: /content)
|
|
|
|
@property
|
|
def database_url(self) -> str:
|
|
return (
|
|
f"postgresql://{self.postgres_user}:{self.postgres_password}"
|
|
f"@{self.postgres_host}:{self.postgres_port}/{self.postgres_db}"
|
|
)
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_prefix = ""
|
|
|
|
|
|
settings = Settings()
|