Skip to content

Commit 1859bfa

Browse files
committed
fix: update certs-gc.sh
1 parent 241f3e8 commit 1859bfa

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

scripts/certs-gc.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/usr/bin/env sh
22

3-
response=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/ssl/certificate_packs" \
3+
domain="$1"
4+
5+
response=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/ssl/certificate_packs" \
46
-H "Content-Type: application/json" \
5-
-H "Authorization: Bearer $POLYKEY_DOCS_CLOUDFLARE_CLEANUP_TOKEN")
7+
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN")
68

7-
cert_ids=$(echo "$response" | jq -r --arg domain "$DOMAIN" '.result[] | select(.hosts[] | contains($domain)) | .id')
9+
cert_ids=$(echo "$response" | jq -r --arg domain "$domain" '.result[] | select(.hosts[] | contains($domain)) | .id')
810

911
echo "$cert_ids" | while read -r cert_id; do
10-
curl -X DELETE --url "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/ssl/certificate_packs/$cert_id" \
12+
curl -X DELETE --url "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/ssl/certificate_packs/$cert_id" \
1113
-H "Content-Type: application/json" \
12-
-H "Authorization: Bearer $POLYKEY_DOCS_CLOUDFLARE_CLEANUP_TOKEN"
14+
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
1315
done

0 commit comments

Comments
 (0)