CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/scripts/cloudflare-clear-cache.sh
Views: 687
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