Skip to content

Commit

Permalink
update cdn script
Browse files Browse the repository at this point in the history
  • Loading branch information
Revyn112 committed Dec 23, 2023
1 parent e2cac43 commit 591f1c0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/cdn-cf.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

CDN_URL="https://worker.headwindsim.net"
CDN_PURGE_LINK="https://worker.headwindsim.net/purgeCache"
CDN_URL="https://cdn.headwindsim.net"
CDN_PURGE_LINK="https://cdn.headwindsim.net/purgeCache?url=https://cdn.headwindsim.net"
CDN_DIR=${1:-"installer/test"}
LOCAL_DIR=${2:-"./dist"}

Expand Down Expand Up @@ -31,4 +31,9 @@ done

# Purge after all uploads that the files are somewhat in sync
echo "Purging cache"
curl -X GET -H "X-HDW-Access-Key: $CLOUDFLARE_WORKER_PASSWORD" -H "Content-Length: 0" "$CDN_PURGE_LINK"
for FILE in "${LOCAL_DIR}"/*; do
DEST="$CDN_PURGE_LINK/$CDN_DIR/$(basename -- "$FILE")"
echo "Purging cache for file: $FILE"
echo "Purge URL: $DEST"
curl -X GET -H "X-HDW-Access-Key: $CLOUDFLARE_WORKER_PASSWORD" -H "Content-Length: 0" "$DEST"
done

0 comments on commit 591f1c0

Please sign in to comment.