from pathlib import Path from pydantic import Field, field_validator from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", extra="ignore" ) api_key: str = Field(..., min_length=8) openrouter_api_key: str = Field(..., min_length=8) openrouter_base_url: str = "https://openrouter.ai/api/v1" llm_model_default: str = "anthropic/claude-sonnet-4" public_base_url: str = Field(...) data_dir: Path = Path("/data") templates_seed_dir: Path = Path("/app/services/mcp-docugen/templates_seed") inline_stylesheet_path: Path | None = Path("/app/themes/tielogic.css") docx_reference_path: Path | None = Path("/app/themes/tielogic-reference.docx") asset_ttl_days: int = 30 max_image_size_mb: int = 10 llm_timeout_seconds: int = 60 @field_validator("public_base_url") @classmethod def strip_trailing_slash(cls, v: str) -> str: return v.rstrip("/")