NewsAtlas/backend/app/config.py

47 lines
1.5 KiB
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")
# --- Flights overlay (OpenSky Network) ---
# Anonymous access works out of the box but is capped at 400 credits/day;
# a full-globe states/all poll costs several credits, so the default
# interval below is deliberately conservative. Free registration
# (opensky-network.org) raises the cap to 4000/day — set these and drop
# FLIGHTS_POLL_SECONDS if you want closer-to-live updates.
opensky_username: str = ""
opensky_password: str = ""
flights_poll_seconds: int = 300
military_ranges_file: str = str(APP_DIR / "data" / "military_ranges.yaml")
class Config:
env_file = ".env"
settings = Settings()