Skip to content

Instantly share code, notes, and snippets.

@gfodor
Created March 20, 2020 20:51
Show Gist options
  • Save gfodor/c219899e8225a4fb4cb71b4adf068291 to your computer and use it in GitHub Desktop.
Save gfodor/c219899e8225a4fb4cb71b4adf068291 to your computer and use it in GitHub Desktop.
Script to update CORS proxy worker
#!/usr/bin/env bash
HOST=$1
TOKEN=$2
WORKER=$3
# Usage examples:
#
# Enable worker:
# set_worker.sh "hubs.ieeevr.online" "<auth token>" "workerdomain.com"
# Disable worker:
# set_worker.sh "hubs.ieeevr.online" "<auth token>" ""
curl -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -XPATCH -d "{ \"phx\": { \"cors_proxy_url_host\": \"$WORKER\" } }" "https://$HOST/api/ita/configs/reticulum"
curl -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -XPATCH -d "{ \"general\": { \"cors_proxy_server\": \"$WORKER\" } }" "https://$HOST/api/ita/configs/hubs"
curl -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -XPATCH -d "{ \"general\": { \"cors_proxy_server\": \"$WORKER\" } }" "https://$HOST/api/ita/configs/spoke"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment