bunnycdn-purge/run.sh
2021-05-07 13:15:41 -04:00

24 lines
390 B
Bash

#!/bin/bash
set +x
URLs=$(export | grep PURGE_URL | cut -d'=' -f2- | sed 's/"//g')
#if [[ -z "${URL}" ]]
#then
# echo "Please defind a URL"
# exit 1
#fi
if [[ -z "${BUNNYCDN_API}" ]]
then
echo "Please define API_TOKEN"
exit 1
fi
for f in ${URLs}; do
curl -s -X POST \
-H 'AccessKey: '"${BUNNYCDN_API}"'' \
-H 'Content-Length: 0' \
'https://api.bunny.net/purge?url='"${f}"
done