Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Direct users to add kv-namespaces to specific portion of toml #798

Closed
EverlastingBugstopper opened this issue Oct 23, 2019 · 2 comments · Fixed by #937
Closed

Direct users to add kv-namespaces to specific portion of toml #798

EverlastingBugstopper opened this issue Oct 23, 2019 · 2 comments · Fixed by #937
Assignees
Labels

Comments

@EverlastingBugstopper
Copy link
Contributor

EverlastingBugstopper commented Oct 23, 2019

cc @steveklabnik

If users add kv-namespaces snippet under a [site] config, the namespace is not parsed into a Wrangler Manifest so the namespace is still inaccessible to a worker.

account_id = "f5518bfbf88c230551a64797c221c7da"
name = "website"
type = "webpack"
route = "www.steveklabnik.com/*"
zone_id = "9359b254c46ff9f5c546203686794862"
workers_dev = false

[site]
bucket = "./public"
entry-point = "workers-site"

kv-namespaces = [
         { binding = "new_namespace", id = "5161cf32bf194293a8591c3c65a24c0a" }
]

We should do two things here:

  1. If we detect kv-namespaces in the site struct, we should warn them to move it
  2. When we ask people to add kv-namespaces to their toml, we should direct them to add it to the top level config, and not below site

Alternatively we could just rewrite their toml for them but that gets a little hairy, especially if they have things like comments

@gabbifish
Copy link
Contributor

I think option 1 is by far the best option. Option 2 doesn't play well with folks who have different environments and don't necessarily want to put their kv-namespaces up in the top-level config.

@gabbifish
Copy link
Contributor

gabbifish commented Dec 6, 2019

Actually, could we even just make

[site]
bucket = ""
entry-point ""

into

site = {
    bucket = "", entry-point = ""
} 

instead? This way, there is no way kv-namespaces will be accidentally lumped under sites. We can also stop users from getting confused between sites and environments...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants