- FastAPI twin of DealGod (async SQLAlchemy/asyncpg). wowplatter/v1: ping, inventory/lookup, inventory/intake (enriches from discogs_full by release_id). - schema v2: unified inventory (vinyl+general), slim crate, sales/sale_items. Discogs catalog NOT copied — joined from discogs_full at read time. - migrate.py: 34,543 shop rows moved (vs ~3.2M in the WowPlatter clone). - Smoke test green; plan/readme carry the architecture + UI boundary. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
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}
|