Files
netbox-reporter/files/entrypoint.sh
ansible user d944e464d0 first commit
2025-10-23 12:56:30 +02:00

29 lines
754 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
log(){ echo "[netbox-reporter][entrypoint] $*"; }
err(){ echo "[netbox-reporter][entrypoint][ERROR] $*" >&2; }
# Sanity: tools
for bin in curl jq; do
command -v "$bin" >/dev/null 2>&1 || { err "Missing $bin"; exit 2; }
done
# Required env (all fed from .env via compose)
: "${RMQ_USER:?RMQ_USER required}"
: "${RMQ_PASS:?RMQ_PASS required}"
: "${RMQ_HOST:?RMQ_HOST required}"
: "${RMQ_PORT:?RMQ_PORT required}"
: "${VHOST:?VHOST required}"
: "${QUEUE:?QUEUE required}"
: "${SLEEP_SECS:?SLEEP_SECS required}"
: "${NB_URL:?NB_URL required}"
: "${NB_TOKEN:?NB_TOKEN required}"
log "RMQ=http://${RMQ_HOST}:${RMQ_PORT} vhost='${VHOST}' queue='${QUEUE}'"
log "NB_URL=${NB_URL}"
# Hand off to main script
exec "$@"