Unifi-Voucher-Tool/docker/entrypoint.sh
Claude 9463486225
Erweiterte Features (2/2): Cleanup/DSGVO, Webhooks, REST-API, Backup, CI, Docker
- Auto-Cleanup/DSGVO: cron_cleanup.php (token-geschützt) löscht abgelaufene
  Voucher, Audit-Log, Login-Versuche und Reset-Tokens nach konfigurierbaren
  Fristen
- Webhooks: includes/Notifier.php (Slack/Teams/generisch), Auslösung bei
  Voucher-Erstellung (Web + API)
- REST-API: includes/ApiKey.php (SHA-256, Präfix-Lookup), api/bootstrap.php,
  api/vouchers.php (GET/POST), api/sites.php; admin/api_keys.php zur Verwaltung
- Config-Backup/Restore: admin/backup.php (JSON Export/Import, Cron-Token
  geschützt)
- admin/integrations.php: Trusted-Proxy, Webhook, Cleanup-Fristen
- CI: .github/workflows/ci.yml (php -l auf 7.4 & 8.2, lang-Validierung)
- Docker: Dockerfile, docker-compose.yml (MariaDB), entrypoint (config aus ENV),
  .dockerignore
- Nav + i18n (DE/EN) für alle neuen Admin-Seiten
2026-06-05 19:45:28 +00:00

29 lines
1.1 KiB
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
CONFIG=/var/www/html/config.php
# config.php aus Umgebungsvariablen erzeugen, falls noch nicht vorhanden und
# DB-Variablen gesetzt sind. Sonst kann der Web-Installer (install.php) genutzt
# werden. APP_KEY wird einmalig generiert und sollte als ENV persistiert werden.
if [ ! -f "$CONFIG" ] && [ -n "$DB_HOST" ] && [ -n "$DB_NAME" ]; then
if [ -z "$APP_KEY" ]; then
APP_KEY=$(php -r 'echo base64_encode(random_bytes(32));')
echo "[entrypoint] WARN: kein APP_KEY gesetzt generiere einmaligen Schluessel."
echo "[entrypoint] Fuer dauerhaften Betrieb APP_KEY als ENV setzen: $APP_KEY"
fi
cat > "$CONFIG" <<PHP
<?php
define('DB_HOST', getenv('DB_HOST') ?: '${DB_HOST}');
define('DB_NAME', getenv('DB_NAME') ?: '${DB_NAME}');
define('DB_USER', getenv('DB_USER') ?: '${DB_USER}');
define('DB_PASS', getenv('DB_PASS') ?: '${DB_PASS}');
define('APP_KEY', getenv('APP_KEY') ?: '${APP_KEY}');
define('SESSION_LIFETIME', (int)(getenv('SESSION_LIFETIME') ?: 3600));
date_default_timezone_set(getenv('TZ') ?: 'Europe/Berlin');
PHP
chown www-data:www-data "$CONFIG"
echo "[entrypoint] config.php aus ENV erzeugt."
fi
exec "$@"