wilsonianb
wilsonianb
CDCloudflare Developers
Created by jason on 8/2/2024 in #kv
I'm using Cloudflare Pages with KV.
https://developers.cloudflare.com/pages/functions/wrangler-configuration/#environment-specific-overrides
If you wanted to have configuration values apply to local and preview, but override production, your file would look like this:
name = "my-pages-site"
pages_build_output_dir = "./dist"

[[kv_namespaces]]
binding = "KV"
id = "<NAMESPACE_ID>"

[vars]
API_KEY = "1234567asdf"

[[env.production.kv_namespaces]]
binding = "KV"
id = "<PRODUCTION_NAMESPACE_ID>"

[env.production.vars]
API_KEY = "8901234bfgd"
name = "my-pages-site"
pages_build_output_dir = "./dist"

[[kv_namespaces]]
binding = "KV"
id = "<NAMESPACE_ID>"

[vars]
API_KEY = "1234567asdf"

[[env.production.kv_namespaces]]
binding = "KV"
id = "<PRODUCTION_NAMESPACE_ID>"

[env.production.vars]
API_KEY = "8901234bfgd"
14 replies
CDCloudflare Developers
Created by sia on 8/2/2024 in #workers-discussions
function calling a worker with data
Unless functions have some extra limitations, I'm guessing you can use either RPC or do fetch with a request with your JSON data. https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#interfaces
2 replies