admin / Bid-Sentinel
publicBid Scrape and Tracking Application with AI Capability
Bid-Sentinel / bid-sentinel-v2 / backend / app / config.py
1637 B · main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | """Application configuration loaded from environment variables.""" from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env", extra="ignore") # Database database_url: str = "postgresql+asyncpg://ctt:ctt_password@db:5432/ctt" # Security / JWT jwt_secret: str = "change-me-in-production" jwt_algorithm: str = "HS256" access_token_expire_minutes: int = 43200 # 30 days # Scraper scraper_enabled: bool = True # Fallback cadence used only when no schedule slots are defined. scraper_interval_minutes: int = 360 # Timezone in which schedule day/time slots are interpreted. schedule_timezone: str = "Europe/London" # CORS (comma separated list) cors_origins: str = "http://localhost:8080,http://localhost:5173" # AI bolt-on (optional). Low-cost model by default. Toggled on/off in the UI; # only usable when an API key is configured. anthropic_api_key: str = "" ai_model: str = "claude-haiku-4-5" # Outgoing email (optional). Reports are emailed only to the logged-in user's # own address. Email features appear only when SMTP_HOST is set. smtp_host: str = "" smtp_port: int = 587 smtp_username: str = "" smtp_password: str = "" smtp_from: str = "" smtp_starttls: bool = True @property def cors_origin_list(self) -> list[str]: return [o.strip() for o in self.cors_origins.split(",") if o.strip()] @lru_cache def get_settings() -> Settings: return Settings() settings = get_settings() |