Skip to content

Instantly share code, notes, and snippets.

@dfar-io
Created January 12, 2022 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfar-io/14608fb10cbfdbb3e05649c78a0e876c to your computer and use it in GitHub Desktop.
Save dfar-io/14608fb10cbfdbb3e05649c78a0e876c to your computer and use it in GitHub Desktop.
#!/bin/bash
# Deletes the appropriate TXT record after 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 DELETE \
--url "https://api.godaddy.com/v1/domains/${domain[1]}.${domain[2]}/records/TXT/_acme-challenge.${domain[0]}" \
--header "Authorization: sso-key $1:$2" \
--header 'Content-Type: application/json'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment