Reccomended Way To Run Npx Wrangler Pages Dev with preview/production env vars?

My Wrangler toml is configured correctly with preview and production enviromnent variables as described by the documentation here https://developers.cloudflare.com/pages/functions/wrangler-configuration/. However, I am unsure of how to run the development server with different environment variables other than [vars] -- which are the only ones injected by saying 'npx wrangler pages dev out/' Asked perplexity and got the use of a non-existent flag '--env'. Tried using 'npx wrangler pages dev out/ --branch main/preview/etc' and that didn't work either. I know I can do manual bindings and override other environment varaibles by saying '... --binding env_var=val1 --binding env_var=val2' but that is tedious and seems like there should be an easier way to just load different configs for the development server. Are there?
Cloudflare Docs
Configuration · Cloudflare Pages docs
Pages Functions can be configured two ways, either via the Cloudflare dashboard or the wrangler.toml / wrangler.json file, a file used to customize the development and deployment setup for Workers and Pages Functions.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?