System environment variables are local environment variables that can change Wrangler's behavior. There are three ways to set system environment variables:
-
Create an
.envfile in your project directory. Set the values of your environment variables in your.envfile. This is the recommended way to set these variables, as it persists the values between Wrangler sessions. -
Inline the values in your Wrangler command. For example,
WRANGLER_LOG="debug" npx wrangler deploywill set the value ofWRANGLER_LOGto"debug"for this execution of the command. -
Set the values in your shell environment. For example, if you are using Z shell, adding
export CLOUDFLARE_API_TOKEN=...to your~/.zshrcfile will set this token as part of your shell configuration.
Wrangler supports the following environment variables:
CLOUDFLARE_ACCOUNT_IDstringoptional- The