Created
January 12, 2022 14:41
-
-
Save dfar-io/0ecb34c1a4c4f7410d20a5016b67c64f 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
#!/bin/bash | |
# Adds the appropriate TXT record for creating a Let's Encrypt certificate. | |
# exit when any command fails | |
set -e | |
if [ "$1" == "" ] || [ "$2" == "" ] | |
then | |
echo "GODADDY_API_KEY and GODADDY_API_SECRET arguments required." | |
exit 1 | |
fi | |
# split domain provided | |
IFS='.' read -ra domain <<< "$CERTBOT_DOMAIN" | |
curl --request PATCH \ | |
--url "https://api.godaddy.com/v1/domains/${domain[1]}.${domain[2]}/records" \ | |
--header "Authorization: sso-key $1:$2" \ | |
--header 'Content-Type: application/json' \ | |
--data '[ | |
{ | |
"data": "'$CERTBOT_VALIDATION'", | |
"name": "_acme-challenge.'${domain[0]}'", | |
"port": 65535, | |
"priority": 0, | |
"protocol": "string", | |
"service": "string", | |
"ttl": 600, | |
"type": "TXT", | |
"weight": 0 | |
} | |
]' | |
sleep 25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment