import os from fastapi import Header, HTTPException # Single-tenant v1: one store, one token from the environment. STORE = os.getenv("RECORDGOD_STORE", "Monster Robot Party") PLAN = os.getenv("RECORDGOD_PLAN", "enterprise") TOKEN = os.getenv("RECORDGOD_TOKEN") # no default — unset means "deny everything", not "open" async def require_token(authorization: str | None = Header(None)): # ponytail: Bearer per WOWPLATTER_BRIEF. The auth scheme is still an OPEN decision # (DealGod's X-API-Key vs this Bearer) — keep the resolver in this one function so # flipping it, or swapping the env token for a tokens table / shared DealGod session, # is a single-file change. if not TOKEN: raise HTTPException(503, "RECORDGOD_TOKEN not configured") if not authorization or not authorization.startswith("Bearer "): raise HTTPException(401, "missing bearer token") if authorization[7:].strip() != TOKEN: raise HTTPException(401, "invalid token") # ponytail: store_id is always 1 for now — the seam for multi-shop, not the room. return {"store": STORE, "plan": PLAN, "store_id": 1}