from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore") app_name: str = "Silos API" debug: bool = True # SQLite by default for local dev; switch to PostgreSQL in production database_url: str = "sqlite:///./silos.db" mongodb_url: str = "mongodb://localhost:27017" mongodb_db: str = "silos" secret_key: str = "change-this-to-a-long-random-secret-key-in-production" access_token_expire_minutes: int = 60 refresh_token_expire_days: int = 7 cors_origins: str = "http://localhost:5173,http://127.0.0.1:5173" @property def is_sqlite(self) -> bool: return self.database_url.startswith("sqlite") @property def cors_origin_list(self) -> list[str]: return [origin.strip() for origin in self.cors_origins.split(",") if origin.strip()] settings = Settings()