From 79cb3ba96fa159a771083127c74f181f8f891ef6 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Sun, 13 Nov 2022 18:53:39 +0800 Subject: [PATCH] update cloudflare README. --- serverless/cloudflare/README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/serverless/cloudflare/README.md b/serverless/cloudflare/README.md index 9c2b0e9..22b4d28 100644 --- a/serverless/cloudflare/README.md +++ b/serverless/cloudflare/README.md @@ -4,11 +4,13 @@ Use [rclone](https://rclone.org/downloads/) to upload your PMTiles archives to a # Getting started -Edit `wrangler.toml` with a new name + your development and production R2 buckets. +* First run `npm install` in the root `PMTiles/js` directory, then `npm install` in `PMTiles/serverless/cloudflare` -Test in development: `npm run start` +* Edit `wrangler.toml` with a new name + your development and production R2 buckets. -Publish the worker: `npm run deploy` +* Test in development: `npm run start` + +* Publish the worker: `npm run deploy` # Settings @@ -18,6 +20,11 @@ This behavior can be customized with optional environment variables: `PMTILES_PATH` - A string like `folder/{name}.pmtiles` specifying the path to archives in your bucket. Default `{name}.pmtiles` +`TILES_PATH` - a string like `prefix/{name}/{z}/{x}/{y}.{ext}` specifying the tile path exposed by the worker. Default `{name}/{z}/{x}/{y}.{ext}` + +`ALLOWED_ORIGINS` - a comma-separated list of allowed CORS origions. Default none. Examples: `https://example.com,https://localhost:3000`, `*` + + # Using the Workers web editor Generate the Workers script using `npm run build` and copy `dist/index.js` to the editor.