mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-01-31 02:50:03 +08:00
build: commit cloudflare purge script to the repo
Added the cloudflare purge script to the repo so that it can be easily used later by release-it
This commit is contained in:
parent
d5537c7f36
commit
2356219999
3 changed files with 19 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -90,7 +90,6 @@ backend/server.version
|
|||
#cloudflare y
|
||||
.cloudflareKey.txt
|
||||
.cloudflareKey_copy.txt
|
||||
purgeCfCache.sh
|
||||
|
||||
frontend/static/adtest.html
|
||||
backend/lastId.txt
|
||||
|
|
17
bin/purgeCfCache.sh
Executable file
17
bin/purgeCfCache.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/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
|
2
example.env
Normal file
2
example.env
Normal file
|
@ -0,0 +1,2 @@
|
|||
CF_ZONE_ID= #cloudflare zone id
|
||||
CF_API_KEY= #cloudflare api key
|
Loading…
Reference in a new issue