Files
MatchLiveTv/infra/scripts/ensure_garage_prod_config.sh
Emiliano Frascaro fd225fbadd Aggiunge Garage al compose di produzione e script di bootstrap.
Rails e Sidekiq usano S3 interno (http://garage:3900); setup_garage_production.sh
configura bucket, chiavi e infra/.env sul server.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 08:05:35 +02:00

26 lines
639 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 [ -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"