Files
2026-05-06 09:37:01 +02:00

36 lines
971 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
set -e
RETRY_INTERVAL=3
# If no db_config.json exists yet, skip the wait (first-run setup mode).
python - <<'EOF'
import sys, os
config_path = os.environ.get("DB_CONFIG_PATH", "/config/db_config.json")
if not os.path.exists(config_path):
sys.exit(1)
EOF
DB_CONFIGURED=$?
if [ "$DB_CONFIGURED" -eq 1 ]; then
echo "[entrypoint] Keine DB-Konfiguration gefunden starte im Setup-Modus."
else
echo "[entrypoint] DB-Konfiguration gefunden warte auf MariaDB..."
while true; do
python - <<'EOF'
import sys
from util.db_config import load_config, test_connection
config = load_config()
sys.exit(0 if config and test_connection(config) else 1)
EOF
if [ $? -eq 0 ]; then
echo "[entrypoint] MariaDB erreichbar starte Flask."
break
fi
echo "[entrypoint] MariaDB noch nicht bereit neuer Versuch in ${RETRY_INTERVAL}s..."
sleep "$RETRY_INTERVAL"
done
fi
exec python app.py