update cloudflare README.

This commit is contained in:
Brandon Liu
2022-11-13 18:53:39 +08:00
parent a645710410
commit 79cb3ba96f

View File

@@ -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.