mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-20 06:44:47 -07:00
docs: update generated docs
This commit is contained in:
34
scripts/cf-purge.sh
Executable file
34
scripts/cf-purge.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
if [ -f "$SCRIPT_DIR/.tokens" ]; then
|
||||
source "$SCRIPT_DIR/.tokens"
|
||||
fi
|
||||
|
||||
echo "=== Cloudflare cache purge ==="
|
||||
echo ""
|
||||
|
||||
if [ -z "$CF_API_TOKEN" ]; then
|
||||
echo "CF_API_TOKEN not set. Add it to scripts/.tokens"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$CF_ZONE_ID" ]; then
|
||||
echo "CF_ZONE_ID not set. Add it to scripts/.tokens"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RESPONSE=$(curl -sS -X POST \
|
||||
"https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/purge_cache" \
|
||||
-H "Authorization: Bearer $CF_API_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"purge_everything":true}')
|
||||
|
||||
if echo "$RESPONSE" | grep -q '"success":true'; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Purge failed:"
|
||||
echo "$RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user