"""Environment configuration. Every external service is optional — the backend degrades to local in-memory mode so the demo never blocks.""" import os from pathlib import Path from dotenv import load_dotenv load_dotenv() BASE_DIR = Path(__file__).parent MENU_FILE = BASE_DIR / "data" / "byg_menu.json" SUPABASE_URL = os.getenv("SUPABASE_URL", "") SUPABASE_SERVICE_KEY = os.getenv("SUPABASE_SERVICE_KEY", "") BOLNA_API_KEY = os.getenv("BOLNA_API_KEY", "") BOLNA_AGENT_ID = os.getenv("BOLNA_AGENT_ID", "") BOLNA_WS_HOST = os.getenv("BOLNA_WS_HOST", "") # e.g. wss://ws.bolna.ai BOLNA_API_HOST = os.getenv("BOLNA_API_HOST", "https://api.bolna.ai") # Bearer token Bolna tools must present when calling this backend. # Empty value disables auth (local dev). BACKEND_API_TOKEN = os.getenv("BACKEND_API_TOKEN", "") # Origins allowed to call this API from the browser. CORS_ORIGINS = [ o.strip() for o in os.getenv("CORS_ORIGINS", "http://localhost:3000").split(",") if o.strip() ] DEFAULT_OUTLET = "Hennur" OUTLETS = ["Hennur", "Sarjapur", "Yeshwantpur"] # Admin key gates /api/copilot, /api/table-tokens, /api/menu/availability. # Empty value disables auth for local dev. ADMIN_KEY = os.getenv("ADMIN_KEY", "") # Secret for HMAC-signed opaque table QR tokens. TABLE_TOKEN_SECRET = os.getenv("TABLE_TOKEN_SECRET", "dev-secret") def supabase_configured() -> bool: return bool(SUPABASE_URL and SUPABASE_SERVICE_KEY)