Skip to content

Commit

Permalink
set public URL to R2
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed May 9, 2024
1 parent 2aebcb0 commit 36d3494
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion .dev.vars
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
API_TOKEN=amogus
R2_PUBLIC_URL=R2_PLACERHOLDER_PUBLIC_URL
6 changes: 6 additions & 0 deletions src/select-zls-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export async function handleSelectZLSVersion(
});
}

if (typeof env.R2_PUBLIC_URL !== "string" || !env.R2_PUBLIC_URL) {
return new Response(null, {
status: 500, // Internal Server Error
});
}

const url = new URL(request.url);
const zigVersionString = url.searchParams.get("zig_version");

Expand Down
4 changes: 2 additions & 2 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ compatibility_flags = ["nodejs_compat"]
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
# Note: Use secrets to store sensitive data.
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
# [vars]
# MY_VARIABLE = "production_value"
[vars]
R2_PUBLIC_URL="https://builds.zigtools.org"

# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
Expand Down

0 comments on commit 36d3494

Please sign in to comment.