refactor(scripts): quotes and spaces

This commit is contained in:
AJ ONeal 2022-06-07 02:27:05 -06:00
parent a7f1398ba4
commit f2d2af3761
Signed by: coolaj86
GPG Key ID: 585419CA6DB0AA23
1 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,7 @@
#!/bin/bash
set -e
set -u
source .env source .env
# 1. (srv) create a new shared key for a given slug # 1. (srv) create a new shared key for a given slug
@ -6,12 +10,14 @@ source .env
# 4. (dev) use key to connect to remote # 4. (dev) use key to connect to remote
# 5. (dev) ping occasionally # 5. (dev) ping occasionally
TOKEN=$(go run cmd/signjwt/*.go \ TOKEN="$(
--expires-in 1m \ go run cmd/signjwt/*.go \
--vendor-id "$VENDOR_ID" \ --expires-in 1m \
--secret "$RELAY_SECRET" \ --vendor-id "$VENDOR_ID" \
--machine-ppid "$RELAY_SECRET" --secret "$RELAY_SECRET" \
) --machine-ppid "$RELAY_SECRET"
)"
echo "${TOKEN}"
MGMT_URL=${MGMT_URL:-"http://mgmt.example.com:6468/api"} MGMT_URL=${MGMT_URL:-"http://mgmt.example.com:6468/api"}
@ -19,4 +25,4 @@ CLIENT_SUBJECT=${CLIENT_SUBJECT:-"newbie"}
curl -X POST "$MGMT_URL/devices" \ curl -X POST "$MGMT_URL/devices" \
-H "Authorization: Bearer ${TOKEN}" \ -H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{ "slug": "'$CLIENT_SUBJECT'" }' -d '{ "slug": "'"$CLIENT_SUBJECT"'" }'