Skip to content

Commit 52c0a5d

Browse files
temp: fix worker route to correct domain
1 parent 42854e2 commit 52c0a5d

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/fix-route.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Fix Worker Route
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
fix-route:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Fix Worker Route
15+
env:
16+
CF_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
17+
run: |
18+
set -x
19+
ZONE_ID="5b3f8237bfa2518bff375eb8163623a5"
20+
21+
# Get existing routes
22+
ROUTES=$(curl -s -H "Authorization: Bearer $CF_API_TOKEN" \
23+
"https://api.cloudflare.com/client/v4/zones/$ZONE_ID/workers/routes")
24+
25+
# Find the old natalie route
26+
OLD_ROUTE_ID=$(echo "$ROUTES" | jq -r '.result[] | select(.pattern | test("natalie\\.acreonetionos\\.org")) | .id')
27+
echo "Old route ID: $OLD_ROUTE_ID"
28+
29+
# Delete the old route
30+
if [ -n "$OLD_ROUTE_ID" ] && [ "$OLD_ROUTE_ID" != "null" ]; then
31+
echo "Deleting old route..."
32+
curl -s -X DELETE \
33+
"https://api.cloudflare.com/client/v4/zones/$ZONE_ID/workers/routes/$OLD_ROUTE_ID" \
34+
-H "Authorization: Bearer $CF_API_TOKEN" | jq .
35+
fi
36+
37+
# Add new route for correct domain
38+
echo "Adding route for natalie.acreonetionos.org..."
39+
curl -s -X POST \
40+
"https://api.cloudflare.com/client/v4/zones/$ZONE_ID/workers/routes" \
41+
-H "Authorization: Bearer $CF_API_TOKEN" \
42+
-H "Content-Type: application/json" \
43+
-d '{
44+
"pattern": "natalie.acreonetionos.org/*",
45+
"script": "natalie-proxy"
46+
}' | jq .
47+
48+
echo "=== Done ==="

0 commit comments

Comments
 (0)