~abyxcos/openbsd_scripts

0bb2d6bf2da738ba4a688be274e60edecf7d8399 — abyxcos 1 year, 10 months ago e8fb1ad
Update the JSON blob to use the double single double quote concat method so we don't have to escape all the double quotes. Credit ~jrick.
1 files changed, 8 insertions(+), 6 deletions(-)

M dyn_gandi.sh
M dyn_gandi.sh => dyn_gandi.sh +8 -6
@@ 1,4 1,4 @@
# echo -n "my_secret_api_key" > /root/.gandi.key
# echo -n "my_secret_api_key" > $HOME/.gandi.key
# dyn_gandi.sh domain subdomain
DOMAIN=$1
SUBDOMAIN=$2


@@ 11,11 11,13 @@ case `echo $INET | cut -d ' ' -f 1` in
	'inet6')	CLASS='AAAA'	;;
esac

BODY="{\"items\": [
 {\"rrset_type\":    \"$CLASS\",
  \"rrset_ttl\":     \"1200\",
  \"rrset_values\": [\"$EGRESS_IP\"]}
]}"
BODY='{
	"items": [{
		"rrset_type":    "'"$CLASS"'",
		"rrset_ttl":     "'"1200"'",
		"rrset_values": ["'"$EGRESS_IP"'"]
	}]
}'

echo "PUT /v5/livedns/domains/$DOMAIN/records/$SUBDOMAIN HTTP/1.1
User-Agent: OpenBSD nc