A stupid experiment building a Wiki on Cloudflare Workers with Workers KV for persistence.
Durable Objects would probably be a better idea, and enable simple page edit history.
You will need npm and a Cloudflare account (free).
-
Run
npm install
. -
You'll need a Workers account, register at https://dash.cloudflare.com/sign-up/workers
-
Create an API token from the "Edit Cloudflare Workers" template on https://dash.cloudflare.com/profile/api-tokens
-
Export
CLOUDFLARE_API_TOKEN
andCLOUDFLARE_ACCOUNT_ID
in the shell you usewrangler
-
Create a PAGES and a PAGE_INDEX KV namespace through wrangler: https://developers.cloudflare.com/workers/wrangler/cli-wrangler/commands/#kv
-
Edit wrangler.toml to insert your KV space ids
-
Set basic auth username and password through the secrets
BASICAUTH_USERNAME
andBASICAUTH_PASSWORD
: https://developers.cloudflare.com/workers/wrangler/commands/#secret
npm run start-worker
npm run publish-worker
will make your worker public, remember to set the
basic auth secrets.
MIT, see LICENSE.
(as of 2022-05-28) wrangler
has a transitive dependency on a vulnerable
version of dicer
, it's been bumped in miniflare
cloudflare/miniflare#269 so should soon be fixed in
wrangler
I assume.
- basic auth
- oidc auth