Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/scripts/cloudflare-clear-cache.sh
Views: 275
1
#!/usr/bin/env bash
2
3
echo "Purge the cloudflare clache for sagemath.com -- see https://api.cloudflare.com/#zone-purge-all-files"
4
5
set -e
6
7
export API_KEY=$HOME/secrets/cloudflare/cloudflare
8
9
if [ ! -f $API_KEY ]; then
10
echo "$0: You must put the CloudFlare API key in '$API_KEY'."
11
exit 1
12
else
13
echo "$0: Contacting CloudFlare servers to clear cache."
14
15
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/1f0851c75f9337545904475a1d1bbe71/purge_cache" \
16
-H "X-Auth-Email: [email protected]" \
17
-H "X-Auth-Key: `cat $API_KEY`" \
18
-H "Content-Type: application/json" \
19
--data '{"purge_everything":true}'
20
fi
21
22