From 5c616a94b947b85f8d8fb6caeeaa880de7f684b8 Mon Sep 17 00:00:00 2001 From: Jerry Ng Date: Wed, 18 May 2022 22:12:29 +0800 Subject: [PATCH] feat: add staging environment for testing --- README.md | 2 ++ wrangler.toml | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 412b942..ccc21d6 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ wrangler kv:namespace create "URL_DB" --preview For creating these KV namespaces, remember to update your [`wrangler.toml`](./wrangler.toml) file to include the namespace bindings accordingly. +[Read more](https://developers.cloudflare.com/workers/wrangler/configuration/#configure-wranglertoml) about configuring `wrangler.toml`. + ## Optional: CI/CD 1. This project uses [Wrangler actions](https://github.com/marketplace/actions/deploy-to-cloudflare-workers-with-wrangler) to automatically publish worker. To do so, add `CF_API_TOKEN` into your GitHub repository secrets. You can [create your API token](https://dash.cloudflare.com/profile/api-tokens) using the `Edit Cloudflare Workers` template. diff --git a/wrangler.toml b/wrangler.toml index 1790de3..fb53b7d 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,17 +1,31 @@ -name = "atomic-url" type = "webpack" - account_id = "19a745c88f8264f29c608584b7e417ab" +zone_id = "e69d9e8116a9787a7c36dc16f6195ae2" compatibility_date = "2021-12-26" + +name = "atomic-url-dev" +workers_dev = true kv_namespaces = [ - {binding = "URL_DB", id = "7da8f192d2c1443a8b2ca76b22a8069f", preview_id = "ca7936b380a840908c035a88d1e76584"}, + { binding = "URL_DB", id = "", preview_id = "ca7936b380a840908c035a88d1e76584" }, ] -route = "" -workers_dev = true -zone_id = "e69d9e8116a9787a7c36dc16f6195ae2" [dev] ip = "0.0.0.0" local_protocol = "http" port = 8787 upstream_protocol = "https" + +[env.staging] +name = "atomic-url-staging" +workers_dev = true +kv_namespaces = [ + { binding = "URL_DB", id = "ca7936b380a840908c035a88d1e76584" }, +] + +[env.production] +name = "atomic-url" +route = "s.jerrynsh.com/*" +workers_dev = false +kv_namespaces = [ + { binding = "URL_DB", id = "7da8f192d2c1443a8b2ca76b22a8069f" }, +]