Files
space-booking/backend/entrypoint.sh
Claude Agent 98059a8a70 feat: cont demo public cu resetare automată a datelor la 3 ore
- Cont demo (demo@example.com/demo1234) activ implicit, identificat prin
  settings.demo_email — fără configurare în env; DEMO_EMAIL="" îl dezactivează
- Contul demo nu poate fi modificat prin API (email/parolă/status blocate 403)
- reset_demo.py: șterge idempotent toate datele demo și recrează proprietatea
  demo cu 3 spații și 5 rezervări exemplu cu date relative la ziua curentă
- entrypoint.sh: reset la boot + buclă la 3h (DEMO_RESET_INTERVAL)
- start.sh (dev): reset la fiecare pornire
- Login.vue: hint cu credențialele demo (click = precompletare) și mesajul
  de resetare la 3 ore

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:07:16 +00:00

32 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
# Database tables are created automatically on application startup
# (app/main.py runs Base.metadata.create_all). The first user to register
# becomes the superadmin (the instance owner), so no admin seeding is needed.
#
# The demo seed (seed_db.py) plants sample accounts and content for LOCAL
# DEVELOPMENT only. It is opt-in: set RUN_SEED=1 to enable it. Never set
# RUN_SEED=1 in production.
if [ "${RUN_SEED}" = "1" ]; then
echo "[entrypoint] RUN_SEED=1 -> running demo database seed..."
python seed_db.py
fi
# Public demo account (enabled by default, see settings.demo_email):
# (re)create the demo account and its sample data at boot, then reset it
# periodically in the background (default: every 3h; override with
# DEMO_RESET_INTERVAL, in seconds). Set DEMO_EMAIL="" to disable.
echo "[entrypoint] Resetting demo account..."
python reset_demo.py || echo "[entrypoint] WARNING: demo reset failed (continuing)"
(
while true; do
sleep "${DEMO_RESET_INTERVAL:-10800}"
echo "[entrypoint] Scheduled demo reset..."
python reset_demo.py || echo "[entrypoint] WARNING: demo reset failed"
done
) &
echo "[entrypoint] Starting application..."
exec "$@"