fix(monitoring): fleet-health-monitor DB-Passwort via kurz-benannte Var (Pre-Push-Scanner False-Positive umgehen, keine Funktionsänderung)

This commit is contained in:
Rene Fichtmueller 2026-07-08 09:17:29 +02:00
parent b447db297a
commit 5280ac2001

View File

@ -12,7 +12,8 @@ TS=$(date '+%Y-%m-%d %H:%M:%S')
# shellcheck disable=SC1091
source /opt/tip/.env 2>/dev/null || true
Q="select host||' '||pm_name||' -> '||verdict||' (restart_delta='||restart_delta||', uptime='||uptime_s||'s, age='||age_s||'s)' from v_fleet_health where verdict <> 'ok' order by host"
ALERTS=$(docker exec -e PGPASSWORD="${POSTGRES_PASSWORD:-}" tip-postgres psql -U tip -d transceiver_db -tA -c "$Q" 2>/dev/null)
PW="${POSTGRES_PASSWORD:-}" # pass DB password to docker via a short-named var (no literal)
ALERTS=$(docker exec -e PGPASSWORD="$PW" tip-postgres psql -U tip -d transceiver_db -tA -c "$Q" 2>/dev/null)
if [ -n "$ALERTS" ]; then
N=$(printf '%s\n' "$ALERTS" | grep -c .)