Created
September 17, 2021 04:41
-
-
Save kari/0d4c61cfec9930d0195d2e5d71d7490d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
TOKEN="APITOKEN" | |
ENDPOINT="https://api.gandi.net/v5" | |
DOMAIN="DOMAIN" | |
NAME="NAME" | |
IPV4="$(curl -s https://api.ipify.org)" | |
IPV6="$(curl -s https://api6.ipify.org)" | |
TTL=10800 | |
curl -X PUT -H "Content-Type: application/json" \ | |
-H "Authorization: Apikey $TOKEN" \ | |
-d "{\"items\": [{\"rrset_type\": \"AAAA\", | |
\"rrset_ttl\": $TTL, | |
\"rrset_values\": [\"$IPV6\"]}, | |
{\"rrset_type\": \"A\", | |
\"rrset_ttl\": $TTL, | |
\"rrset_values\": [\"$IPV4\"]}]}" \ | |
$ENDPOINT/livedns/domains/$DOMAIN/records/$NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment