polygrapher / app /config.py
dhruv575
Update and clean
c4a298e
from functools import lru_cache
from typing import Optional
from pydantic import Field
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""Central configuration for the HuggingFace backend."""
default_num_items: int = Field(10, env="POLYGRAPH_DEFAULT_NUM_ITEMS")
skip_dub: bool = Field(False, env="POLYGRAPH_SKIP_DUB")
template_root: str = Field("polygraph(email)/polygraph(email)", env="POLYGRAPH_TEMPLATE_DIR")
template_archive_dir: str = Field("template_archive", env="POLYGRAPH_TEMPLATE_ARCHIVE")
header_path: str = Field("header.png", env="POLYGRAPH_HEADER_PATH")
header_link: str = Field("https://polymarket.com", env="POLYGRAPH_HEADER_LINK")
supabase_url: Optional[str] = Field(None, env="SUPABASE_URL")
supabase_service_key: Optional[str] = Field(None, env="SUPABASE_SERVICE_KEY")
storage_prefix: str = Field("", env="STORAGE_PREFIX")
openai_api_key: Optional[str] = Field(None, env="OPENAI_API_KEY")
dub_workspace_id: str = Field("ws_cm7dm89q90000qmskmss62vla", env="DUB_WORKSPACE_ID")
cors_origins: str = Field("*", env="CORS_ORIGINS")
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
case_sensitive = False
extra = "ignore"
@lru_cache(maxsize=1)
def get_settings() -> Settings:
"""Return a cached instance so imports stay cheap."""
return Settings()