Search code examples
cloudflarecloudflare-workerscloudflare-kv

Should I commit my wrangler.toml file with KV namespace values present?


I've created an API using Cloudflare Workers and it uses their KV service. The KV namespaces are defined in the wrangler.toml file but I'm unsure if it is safe to commit that file with the kv_namespaces values present. I've used the wrangler secrets for API keys but since these aren't environment variables I'm not sure how I should handle them.

What is the correct way to handle pushing a wrangler.toml file to a git repo?


Solution

  • The namespace ID in wrangler.toml is not a secret. When you publish the worker, Cloudflare will authenticate that your account actually owns the namespace, and will not permit the publish otherwise. So, it's safe to commit to git.