mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-14 11:37:06 +08:00
2356219999
Added the cloudflare purge script to the repo so that it can be easily used later by release-it
17 lines
No EOL
505 B
Bash
Executable file
17 lines
No EOL
505 B
Bash
Executable file
#!/bin/bash
|
|
source .env
|
|
echo "Purging Cloudflare cache for zone $CF_ZONE_ID"
|
|
response=$(curl -s -X POST "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/purge_cache" \
|
|
-H "Authorization: Bearer $CF_API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
--data '{"purge_everything":true}')
|
|
|
|
success=$(echo "$response" | grep -o '"success": true')
|
|
|
|
if [ "$success" ]; then
|
|
echo "Cache purged successfully."
|
|
else
|
|
echo "Cache purge failed."
|
|
echo "Response:"
|
|
echo "$response"
|
|
fi |