Files
2026-04-06 00:57:13 +02:00

37 lines
901 B
Bash
Executable File

#!/usr/bin/env bash
# Compila y lanza rapid_dashboards en modo produccion.
# Uso: ./scripts/prod.sh <nombre_dashboard> [env vars...]
# Ejemplo: DB_PASSWORD=secret ./scripts/prod.sh fn_registry_overview
set -euo pipefail
APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
EXAMPLES_DIR="$APP_DIR/examples"
BIN="$APP_DIR/build/bin/rapid-dashboards"
if [ $# -eq 0 ]; then
echo "Dashboards disponibles:"
for f in "$EXAMPLES_DIR"/*.yaml; do
echo " $(basename "$f" .yaml)"
done
echo ""
echo "Uso: $0 <nombre> (sin .yaml)"
exit 0
fi
YAML="$EXAMPLES_DIR/$1.yaml"
if [ ! -f "$YAML" ]; then
echo "Error: no existe $YAML"
exit 1
fi
cd "$APP_DIR"
# Compilar si el binario no existe o el YAML es mas reciente
if [ ! -f "$BIN" ] || [ "$YAML" -nt "$BIN" ]; then
echo "-> compilando..."
CGO_ENABLED=1 wails build -tags fts5
fi
echo "-> $BIN --dashboard $YAML"
exec "$BIN" --dashboard "$YAML"