How to Access System Environment Variables for Development?
Yes I know about defining environment variables in the [vars] of the wrangler.toml, and I also know about .dev.vars. That's not what I mean.
What I need is to pass in system environment variables, e.g.
MY_VAR=foo wrangler dev src/index.ts
This is important to try out different environments, for example spinning up workers for local e2e testing. Plus, having to define all environment variables by hand often leaves my local configuration (managed in Doppler) out of sync.
Any ideas?2 Replies
Use the —var flag
… dev —var FOO:$MY_VAR
Thanks, that solves it!