Files
MatchLiveTv/infra/scripts/ensure_garage_prod_config.sh
Emiliano Frascaro da75582dae Sposta storage video su disco dedicato e completa ops/SMTP in produzione.
Recordings e Garage usano bind mount su /media/videos; aggiunge ntfy self-hosted,
notifiche critical+warning, SMTP Aruba SSL/465 e fix cron replay.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 23:13:08 +02:00

32 lines
813 B
Bash
Executable File

#!/usr/bin/env bash
# Crea garage/garage.prod.toml con secret casuali se mancante (solo produzione).
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
DEST="${ROOT}/garage/garage.prod.toml"
TEMPLATE="${ROOT}/garage/garage.prod.toml.example"
if [ -d "$DEST" ]; then
echo "ERRORE: $DEST è una directory (bind mount Docker senza file sorgente)."
echo "Rimuovi la directory e rilancia questo script."
exit 1
fi
if [ -f "$DEST" ]; then
echo "Config Garage produzione già presente: $DEST"
exit 0
fi
if [ ! -f "$TEMPLATE" ]; then
echo "Manca $TEMPLATE"
exit 1
fi
RPC="$(openssl rand -hex 32)"
ADMIN="$(openssl rand -hex 32)"
sed -e "s/CHANGE_ME_RPC_SECRET_64_HEX/${RPC}/" \
-e "s/CHANGE_ME_ADMIN_TOKEN_64_HEX/${ADMIN}/" \
"$TEMPLATE" > "$DEST"
chmod 600 "$DEST"
echo "Creato $DEST"