NewsAtlas/backend/app/config.py

36 lines
999 B
Python

from pathlib import Path
from pydantic_settings import BaseSettings
APP_DIR = Path(__file__).resolve().parent
class Settings(BaseSettings):
database_path: str = "/data/newsatlas.db"
owm_api_key: str = ""
acled_api_key: str = ""
acled_email: str = ""
rss_poll_minutes: int = 10
market_poll_minutes: int = 15
# Minimum |% change| between two consecutive polls of the same
# instrument before we flag it as a "spike" and go looking for articles
# that might explain it.
market_spike_threshold_pct: float = 1.5
# How far back (and forward, capped at "now") from the previous poll to
# search for candidate-cause articles around a detected spike.
market_spike_lookback_hours: int = 6
conflict_poll_minutes: int = 60
article_window_hours: int = 72
sources_file: str = str(APP_DIR / "sources.yaml")
gazetteer_file: str = str(APP_DIR / "data" / "gazetteer.csv")
class Config:
env_file = ".env"
settings = Settings()