Write to a specific environment's namespace

kv

// what it does

`-e/--env production` resolves the binding from that environment's `kv_namespaces` block, so the same command can target prod versus staging namespaces. Use `-c` instead when each environment lives in its own config file.

// shell

$ wrangler kv key put FEATURE_X on --binding=CONFIG --env production
$ wrangler kv key put FEATURE_X on --binding=CONFIG -c wrangler.staging.jsonc

// gotcha

Without `-e`, the binding resolves to the top-level (default) namespace, which is often NOT your production one — an easy way to silently update the wrong store.