Records pageviews (path, referrer, browser/OS/device, IP, GeoIP country) via a POST /api/track beacon into a new PageView table, and exposes aggregated daily/breakdown stats behind a token-gated GET /api/admin/stats endpoint with brute-force lockout. Frontend gets a /admin dashboard (charts + breakdown tables) built on recharts, with a switchable per-day pageviews chart. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
26 lines
1.1 KiB
Bash
26 lines
1.1 KiB
Bash
# Copy to .env and fill in real values before `docker compose -f docker-compose.prod.yaml up`.
|
|
# .env is gitignored -- never commit real secrets.
|
|
|
|
POSTGRES_USER=bridzik
|
|
POSTGRES_PASSWORD=bridzik
|
|
POSTGRES_DB=bridzik
|
|
|
|
# Comma-separated list of origins allowed to open a Socket.IO connection.
|
|
# Must be the public URL(s) the frontend is served from -- never "*" in prod.
|
|
CORS_ALLOWED_ORIGINS=https://bridzik.liptim.eu
|
|
|
|
# Shared secret for the self-hosted /api/admin/* stats endpoints.
|
|
ADMIN_TOKEN=tajneheslo
|
|
|
|
# Fernet key encrypting Player.totp_secret at rest. Generate with:
|
|
# python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
|
|
# Keep it stable across restarts/redeploys -- losing it locks every account
|
|
# out (their TOTP secret can no longer be decrypted).
|
|
ENCRYPTION_KEY=
|
|
|
|
# Optional: IP -> country for /api/track pageviews (see GEOIP_DB_PATH in
|
|
# docker-compose.prod.yaml). Place a .mmdb file (GeoLite2-City/Country from a
|
|
# MaxMind account, or a DB-IP/IP2Location Lite equivalent) at
|
|
# ./geoip/GeoLite2-City.mmdb next to docker-compose.prod.yaml. Left missing ->
|
|
# country is just recorded as "".
|