#!/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"