Multiplayer scopone scientifico backend on the kaya framework:
- OIDC login (kaya-oidc), session-backed WebSocket auth
- Pure rules engine (forced captures, scopa, primiera scoring) with
full-match simulation tests
- Live game state in Redis (JSON + TTL, join codes, per-game locks,
pub/sub state push); in-memory fallback for tests
- WebSocket /ws/games/{id} for real-time play; REST lobby endpoints
(create/join/snapshot) with hidden-hand views
- Finished matches persisted to Postgres (Tortoise + aerich) for match
history and leaderboard endpoints
- Docker Compose stack: postgres, redis, mock-oauth2-server, db-migrate, app
- 45 tests passing; mypy clean
26 lines
775 B
Bash
26 lines
775 B
Bash
# Postgres
|
|
POSTGRES_HOST=localhost
|
|
POSTGRES_PORT=5432
|
|
POSTGRES_DB=scopa
|
|
POSTGRES_USER=scopa
|
|
POSTGRES_PASSWORD=scopa
|
|
DATABASE_URL=postgres://scopa:scopa@localhost:5432/scopa
|
|
|
|
# OIDC (mock-oauth2-server in dev; it does not validate clients, so any
|
|
# client id/secret works. For a real IdP like Keycloak, use its values here.)
|
|
OIDC_ISSUER=http://localhost:8180/scopa
|
|
OIDC_CLIENT_ID=scopa
|
|
OIDC_CLIENT_SECRET=dev-secret
|
|
OIDC_REDIRECT_URI=http://localhost:8080/auth/callback
|
|
|
|
# Redis (session and live-game storage). Unset to fall back to in-memory
|
|
# stores (only sensible for local development with a single worker).
|
|
REDIS_URL=redis://localhost:6379/0
|
|
|
|
# How long a live game survives in Redis without activity.
|
|
GAME_TTL_SECONDS=86400
|
|
|
|
# App server
|
|
APP_HOST=0.0.0.0
|
|
APP_PORT=8080
|