2021-05-06 19:00:56 -04:00
|
|
|
#!/bin/bash
|
|
|
|
set +x
|
|
|
|
|
2021-05-07 13:14:40 -04:00
|
|
|
URLs=$(export | grep PURGE_URL | cut -d'=' -f2- | sed 's/"//g')
|
2021-05-07 12:57:07 -04:00
|
|
|
|
|
|
|
#if [[ -z "${URL}" ]]
|
|
|
|
#then
|
|
|
|
# echo "Please defind a URL"
|
|
|
|
# exit 1
|
|
|
|
#fi
|
2021-05-06 19:00:56 -04:00
|
|
|
|
|
|
|
if [[ -z "${BUNNYCDN_API}" ]]
|
|
|
|
then
|
|
|
|
echo "Please define API_TOKEN"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-05-07 13:10:17 -04:00
|
|
|
for f in ${URLs}; do
|
2021-05-07 09:18:48 -04:00
|
|
|
curl -s -X POST \
|
2021-05-06 19:00:56 -04:00
|
|
|
-H 'AccessKey: '"${BUNNYCDN_API}"'' \
|
|
|
|
-H 'Content-Length: 0' \
|
2021-05-07 12:57:07 -04:00
|
|
|
'https://api.bunny.net/purge?url='"${f}"
|
|
|
|
done
|