Skip to content

Instantly share code, notes, and snippets.

@johackim johackim/remove.sh

Last active Jun 13, 2020
Embed
What would you like to do?
Remove traefik certificate on consul
#!/bin/sh
DOMAIN=$1
if [[ -z "$1" ]]; then
echo "usage: remove.sh [domain]"
exit 1
fi
consul kv get traefik/acme/account/object | gzip -dc > acme.json
# remove invalid domain and store it to acme-fixed.json
cat acme.json | jq -r 'del (.DomainsCertificate.Certs[] | select(.Domains.Main=="'$DOMAIN'"))' > acme-fixed.json
# gzip it
cat acme-fixed.json | gzip -c > acme-fixed.json.gz
# upload fixed and gzipped json back to consul
consul kv put traefik/acme/account/object @acme-fixed.json.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.