from pydantic_settings import BaseSettings from typing import Optional import os from pathlib import Path class Settings(BaseSettings): # API Settings API_V1_STR: str = "/api/v1" PROJECT_NAME: str = "Legal Document Masker API" # Security SECRET_KEY: str = "your-secret-key-here" # Change in production ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8 # 8 days # Database DATABASE_URL: str = "sqlite:///./legal_doc_masker.db" # File Storage BASE_DIR: Path = Path(__file__).parent.parent.parent UPLOAD_FOLDER: Path = BASE_DIR / "storage" / "uploads" PROCESSED_FOLDER: Path = BASE_DIR / "storage" / "processed" MAX_FILE_SIZE: int = 50 * 1024 * 1024 # 50MB ALLOWED_EXTENSIONS: set = {"pdf", "docx", "doc"} # Celery CELERY_BROKER_URL: str = "redis://localhost:6379/0" CELERY_RESULT_BACKEND: str = "redis://localhost:6379/0" class Config: case_sensitive = True env_file = ".env" def __init__(self, **kwargs): super().__init__(**kwargs) # Create storage directories if they don't exist self.UPLOAD_FOLDER.mkdir(parents=True, exist_ok=True) self.PROCESSED_FOLDER.mkdir(parents=True, exist_ok=True) settings = Settings()