telebit/examples/mgmt-ping-as-admin.sh

23 lines
479 B
Bash
Raw Normal View History

2020-07-19 08:16:11 +00:00
#!/bin/bash
set -e
set -u
source .env
2022-06-05 09:41:00 +00:00
MGMT_PORT="${MGMT_PORT:-3000}"
MGMT_URL="${MGMT_URL:-"http://localhost:${MGMT_PORT}/api"}"
2020-07-19 08:16:11 +00:00
2022-06-05 09:41:00 +00:00
TOKEN=$(
go run cmd/signjwt/*.go \
--expires-in 1m \
--vendor-id "$VENDOR_ID" \
--secret "$RELAY_SECRET" \
--machine-ppid "$RELAY_SECRET"
)
2020-07-19 08:16:11 +00:00
2020-07-22 08:05:30 +00:00
echo "MGMT URL: $MGMT_URL"
curl -X POST "$MGMT_URL/ping" -H "Authorization: Bearer ${TOKEN}"
echo ""
2020-07-22 08:05:30 +00:00
curl "$MGMT_URL/inspect" -H "Authorization: Bearer ${TOKEN}"
echo ""