Set environment variables in pages with functions for local development environment

I am using Cloudflare pages with functions (no wrangler.toml).
We can set environment variables in Cloudflare pages dashboard for production, then we can use them like “context.env.ENV_VAR”, it works well.
But how do we set these environment variables for local development environment? For example, we can set KV in the command “npx wrangler pages dev dist --kv XXXX”, is there any similar command for environment variables? I didn’t find it in document.
Thank you

Today, wrangler pages dev <dir> --binding SOME_ENV_VAR="SOME_VALUE" should work, though it’s not super ergonomic if you have a bunch of them unfortunately.

Hopefully we’ll see this land in a release for usage soon:

1 Like

thank you. it works.
Looking forward to the release.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.