Skip to content

Commit 758a582

Browse files
committed
provide a command
1 parent 5ac2fdf commit 758a582

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ This automatically redeploys the worker with the new secret token set as an envi
5454

5555
You can rename the worker by updating the `name` field in the [`worker/wrangler.jsonc`](worker/wrangler.jsonc#L7) file. This will change the public endpoint URL to reflect the new name. A good way is to append a random string to the name, e.g. `webhooks-proxy-tunnel-123abc`.
5656

57-
```jsonc
58-
{
59-
"name": "webhooks-proxy-tunnel-123abc"
60-
// ...
61-
}
57+
```bash
58+
npm run rename-worker
59+
npm run deploy
6260
```
6361

62+
Then remove the old worker from your Cloudflare account to avoid confusion. You can do this in the [Cloudflare dashboard](https://dash.cloudflare.com/).
63+
6464
## About
6565

6666
This tunneling solution is free. It's expected that you self host it on your Cloudflare Free plan. It should take under 10 minutes to deploy the whole thing from scratch and will cost you nothing, require no EULA agreement, no fine text attached, no data protection issues. Just your laptop and your trusty Cloudfare account.

worker/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,5 @@ dist
170170

171171
.dev.vars
172172
.wrangler/
173+
174+
wrangler.jsonc-e

worker/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"cf-typegen": "wrangler types",
1515
"typecheck": "npx tsc --noEmit",
1616
"ci": "npm run cf-typegen && npm run typecheck && npm run build",
17-
"generate-secret": "./generate-secret.sh"
17+
"generate-secret": "./generate-secret.sh",
18+
"rename-worker": "./rename-worker.sh"
1819
},
1920
"devDependencies": {
2021
"prettier": "^3.5.3",

worker/rename-worker.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
echo "Renaming the worker..."
6+
7+
sed -i -e "s/\"webhooks-proxy-tunnel\"/\"webhooks-proxy-tunnel-$(openssl rand -hex 6)\"/g" wrangler.jsonc
8+
9+
echo "✅ Worker renamed in wrangler.jsonc"

0 commit comments

Comments
 (0)