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

21 lines
419 B
Bash
Raw Normal View History

2020-07-19 08:16:11 +00:00
#!/bin/bash
set -e
set -u
source .env
2020-07-22 08:05:30 +00:00
MGMT_URL="${MGMT_URL:-"http://localhost:3000/api"}"
2020-07-19 08:16:11 +00:00
TOKEN=$(go run cmd/signjwt/*.go \
2020-07-20 18:18:08 +00:00
--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 ""