48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
PROJECT_NAME: str = "Doc Forge Reds"
|
|
API_V1_PREFIX: str = "/api/v1"
|
|
DEBUG: bool = False
|
|
|
|
POSTGRES_USER: str = "docforge"
|
|
POSTGRES_PASSWORD: str = "docforge"
|
|
POSTGRES_DB: str = "docforge"
|
|
POSTGRES_HOST: str = "localhost"
|
|
POSTGRES_PORT: int = 5432
|
|
|
|
REDIS_URL: str = "redis://localhost:6379/0"
|
|
CELERY_BROKER_URL: str = "redis://localhost:6379/0"
|
|
CELERY_RESULT_BACKEND: str = "redis://localhost:6379/1"
|
|
|
|
SECRET_KEY: str = "change-me-in-production"
|
|
DEFAULT_MODEL_ID: str = ""
|
|
|
|
STORAGE_ROOT: str = "./storage"
|
|
MAX_UPLOAD_SIZE: int = 50 * 1024 * 1024
|
|
|
|
CORS_ORIGINS: list[str] = ["http://localhost:3000", "http://localhost:5173"]
|
|
|
|
@property
|
|
def DATABASE_URL(self) -> str:
|
|
return (
|
|
f"postgresql+asyncpg://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}"
|
|
f"@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
|
|
)
|
|
|
|
@property
|
|
def DATABASE_URL_SYNC(self) -> str:
|
|
return (
|
|
f"postgresql://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}"
|
|
f"@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
|
|
)
|
|
|
|
model_config = {"env_file": ".env", "env_file_encoding": "utf-8", "case_sensitive": True}
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|