mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
34 lines
869 B
Python
34 lines
869 B
Python
"""Application configuration"""
|
|
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings"""
|
|
# Database settings
|
|
POSTGRES_USER: str
|
|
POSTGRES_PASSWORD: str
|
|
POSTGRES_DB: str
|
|
POSTGRES_HOST: str
|
|
POSTGRES_PORT: str
|
|
|
|
@property
|
|
def DATABASE_URL(self) -> str:
|
|
"""Get database URL"""
|
|
return f"postgresql://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
|
|
|
|
# JWT settings
|
|
JWT_SECRET: str
|
|
JWT_ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 # 24 hours
|
|
|
|
# Telegram settings
|
|
TELEGRAM_BOT_TOKEN: Optional[str] = None
|
|
TELEGRAM_CHAT_ID: Optional[str] = None
|
|
|
|
class Config:
|
|
"""Pydantic config"""
|
|
env_file = ".env"
|
|
|
|
|
|
settings = Settings() |