- Replace free-api-live-football-data (RapidAPI) backend with TheSportsDB - Add PostgreSQL cache layer for permanent data (teams, players, leagues, events) - Replace Bootstrap dashboard with SvelteKit-based interactive dashboard - Restructure MCP tools around TheSportsDB capabilities (get_team_info, get_roster, get_fixtures, get_standings, etc.) - Expose tool registry via GET /api/tools so dashboard stays in sync - Remove legacy modules and references (api_football, sync, RapidAPI env vars)
39 lines
1.8 KiB
Python
39 lines
1.8 KiB
Python
"""Centralised configuration loaded from .env."""
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
# Always load from project root regardless of working directory
|
|
_ENV_PATH = Path(__file__).resolve().parent.parent / '.env'
|
|
load_dotenv(_ENV_PATH)
|
|
|
|
# ── Database ──────────────────────────────────────────────
|
|
DB_HOST = os.getenv('NIKE_DB_HOST')
|
|
DB_PORT = int(os.getenv('NIKE_DB_PORT', 5432))
|
|
DB_USER = os.getenv('NIKE_DB_USER',)
|
|
DB_PASSWORD = os.getenv('NIKE_DB_PASSWORD')
|
|
DB_NAME = os.getenv('NIKE_DB_NAME')
|
|
|
|
# ── TheSportsDB ───────────────────────────────────────────
|
|
SPORTSDB_KEY = os.getenv('NIKE_SPORTSDB_KEY', '3') # '3' = free test key
|
|
SPORTSDB_V2 = "https://www.thesportsdb.com/api/v2/json"
|
|
SPORTSDB_V1 = f"https://www.thesportsdb.com/api/v1/json/{SPORTSDB_KEY}"
|
|
|
|
# ── Followed teams (team_name:league_name, ...) ──────────
|
|
_raw_teams = os.getenv('NIKE_TEAMS', 'Toronto FC:MLS, Arsenal:Premier League')
|
|
FOLLOWED_TEAMS = [
|
|
tuple(pair.strip().split(':', 1))
|
|
for pair in _raw_teams.split(',')
|
|
if ':' in pair
|
|
]
|
|
|
|
# ── Server ────────────────────────────────────────────────
|
|
SERVER_HOST = os.getenv('NIKE_HOST')
|
|
SERVER_PORT = int(os.getenv('NIKE_PORT'))
|
|
SERVER_NAME = "Nike — Football Data Platform"
|
|
# IPs allowed to set X-Forwarded-Proto (your HAProxy host).
|
|
# '*' trusts all — safe when Nike's port is firewalled to HAProxy only.
|
|
TRUSTED_PROXY_IPS = os.getenv('NIKE_TRUSTED_PROXY', '*')
|
|
LOG_LEVEL = os.getenv('NIKE_LOG_LEVEL', 'WARNING')
|