From 5eaf7124a3c27977b0f95e4fe75e295c42b2cc53 Mon Sep 17 00:00:00 2001 From: ciiiii Date: Fri, 14 Jun 2024 02:31:02 +0800 Subject: [PATCH] Fix staging configuration --- src/index.js | 4 ++++ wrangler.toml | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/index.js b/src/index.js index 3f73732..e61d67d 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,7 @@ addEventListener("fetch", (event) => { const dockerHub = "https://registry-1.docker.io"; const routes = { + // production "docker.libcuda.so": dockerHub, "quay.libcuda.so": "https://quay.io", "gcr.libcuda.so": "https://gcr.io", @@ -13,6 +14,9 @@ const routes = { "k8s.libcuda.so": "https://registry.k8s.io", "ghcr.libcuda.so": "https://ghcr.io", "cloudsmith.libcuda.so": "https://docker.cloudsmith.io", + + // staging + "docker-staging.libcuda.so": dockerHub, }; function routeByHosts(host) { diff --git a/wrangler.toml b/wrangler.toml index 70e91fd..17f18f5 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,16 +1,14 @@ name = "cloudflare-docker-proxy" -workers_dev = true -main = "src/index.js" -compatibility_date = "2021-12-07" +compatibility_date = "2023-12-01" [dev] ip = "0.0.0.0" port = 8787 local_protocol = "http" -[vars] -MODE = "production" -TARGET_UPSTREAM = "" +[env.dev.vars] +MODE = "debug" +TARGET_UPSTREAM = "https://registry-1.docker.io" [env.production] name = "cloudflare-docker-proxy" @@ -24,12 +22,14 @@ routes = [ { pattern = "cloudsmith.libcuda.so", custom_domain = true }, ] +[env.production.vars] +MODE = "production" +TARGET_UPSTREAM = "" + [env.staging] name = "cloudflare-docker-proxy-staging" route = { pattern = "docker-staging.libcuda.so", custom_domain = true } [env.staging.vars] - -[env.dev.vars] -MODE = "debug" -TARGET_UPSTREAM = "https://registry-1.docker.io" \ No newline at end of file +MODE = "staging" +TARGET_UPSTREAM = ""