Deploys cloudflare workers without the overhead of wrangler/node
Go to file
Emil Lerch 533ab89fe9
add something about how we expect to work infra updates
The wrangler project does some bundling for us, that we are not
ready to reproduce here. So for the time being, we will do this
manually
2023-10-17 13:51:45 -07:00
src get some basic structure 2023-10-17 13:49:08 -07:00
.gitignore add something about how we expect to work infra updates 2023-10-17 13:51:45 -07:00
build.zig initial commit 2023-10-17 13:39:59 -07:00
LICENSE initial commit 2023-10-17 13:39:59 -07:00
README.md add something about how we expect to work infra updates 2023-10-17 13:51:45 -07:00

Upload worker to CloudFlare

Until we're better

  1. Add accountid.txt to src/ with the CloudFlare account id
  2. Add worker_name.txt to src/ with CloudFlare worker name
  3. zig build run

Getting new index.js

  • Run a real wrangler deploy, then go into the console and copy/paste

Steps we take:

  1. Check if the worker exists: GET https://api.cloudflare.com/client/v4/accounts//workers/services/<worker_name> 404 - does not exist
  2. Add the "script" PUT https://api.cloudflare.com/client/v4/accounts//workers/scripts/<worker_name>?include_subdomain_availability=true&excludeScript=true
  3. Get the "subdomain". I believe this is simply to determine the test url: GET https://api.cloudflare.com/client/v4/accounts//workers/subdomain
  4. Enable the script: This is only done if the script did not exist. Subsequent flows leave this alone POST https://api.cloudflare.com/client/v4/accounts//workers/scripts/<worker_name>/subdomain Data: { "enabled": true }