From f2d2af37615a79115593247ce266b047992c67d2 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 7 Jun 2022 02:27:05 -0600 Subject: [PATCH] refactor(scripts): quotes and spaces --- examples/mgmt-add-device.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/mgmt-add-device.sh b/examples/mgmt-add-device.sh index 7882da1..76fd420 100644 --- a/examples/mgmt-add-device.sh +++ b/examples/mgmt-add-device.sh @@ -1,3 +1,7 @@ +#!/bin/bash +set -e +set -u + source .env # 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 # 5. (dev) ping occasionally -TOKEN=$(go run cmd/signjwt/*.go \ - --expires-in 1m \ - --vendor-id "$VENDOR_ID" \ - --secret "$RELAY_SECRET" \ - --machine-ppid "$RELAY_SECRET" -) +TOKEN="$( + go run cmd/signjwt/*.go \ + --expires-in 1m \ + --vendor-id "$VENDOR_ID" \ + --secret "$RELAY_SECRET" \ + --machine-ppid "$RELAY_SECRET" +)" +echo "${TOKEN}" 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" \ -H "Authorization: Bearer ${TOKEN}" \ -H "Content-Type: application/json" \ - -d '{ "slug": "'$CLIENT_SUBJECT'" }' + -d '{ "slug": "'"$CLIENT_SUBJECT"'" }'