import os from pathlib import Path from dotenv import load_dotenv # Load .env from project folder so Groq/debug flags are available under uvicorn/nohup. _HERE = Path(__file__).resolve().parent.parent load_dotenv(_HERE / ".env") DATA_DIR = Path(os.getenv("NEWS_MCP_DATA_DIR", Path(__file__).resolve().parent / "data")) DATA_DIR.mkdir(parents=True, exist_ok=True) DB_PATH = Path(os.getenv("NEWS_MCP_DB_PATH", str(DATA_DIR / "news.sqlite"))) RSS_FEED_URL = os.getenv("NEWS_RSS_FEED_URL", "https://breakingthenews.net/news-feed.xml") # Clusters TTL (hours) CLUSTERS_TTL_HOURS = float(os.getenv("NEWS_CLUSTERS_TTL_HOURS", "24")) DEFAULT_TOPICS = ["crypto", "macro", "regulation", "ai", "other"] # Optional LLM enrichment (Groq) GROQ_API_KEY = os.getenv("GROQ_API_KEY") GROQ_MODEL = os.getenv("GROQ_MODEL", "llama4-16e") GROQ_DEBUG = os.getenv("GROQ_DEBUG", "false").lower() == "true" # Cost control: only enrich clusters whose heuristic topic is "other" by default. GROQ_ENRICH_OTHER_ONLY = os.getenv("GROQ_ENRICH_OTHER_ONLY", "true").lower() == "true" # Limit enriched clusters per refresh call. GROQ_MAX_CLUSTERS_PER_REFRESH = int(os.getenv("GROQ_MAX_CLUSTERS_PER_REFRESH", "20")) # Background refresh NEWS_REFRESH_INTERVAL_SECONDS = int(os.getenv("NEWS_REFRESH_INTERVAL_SECONDS", "900")) NEWS_BACKGROUND_REFRESH_ENABLED = os.getenv("NEWS_BACKGROUND_REFRESH_ENABLED", "true").lower() == "true" NEWS_BACKGROUND_REFRESH_ON_START = os.getenv("NEWS_BACKGROUND_REFRESH_ON_START", "true").lower() == "true"