Environment variables
Each Begin app’s environments has its own set of independently configurable environment variables.
Creating environment variables
To add an environment variable, use the Begin CLI to execute the following command:
begin env create --env staging --name "FOO" --value "bar"
npx begin env create --env staging --name "FOO" --value "bar"
Editing variables
To modify an existing environment variable, run the same command as before, using the name of the variable you want to change and the new value you want to apply to it.
begin env create --env staging --name "FOO" --value "baz"
npx begin env create --env staging --name "FOO" --value "baz"
Listing variables
To see which environment variables exist for a given environment, use the Begin CLI to list them:
begin env list --env staging
vanilla-to-ssr (app ID: XXXXXXXX)
└── staging (env ID: STGXXXXX): https://local-fih.begin.app
└── FOO=b***
npx begin env list --env staging
vanilla-to-ssr (app ID: XXXXXXXX)
└── staging (env ID: STGXXXXX): https://local-fih.begin.app
└── FOO=b****
Deleting variables
To delete a variable, simply run the destroy command:
begin env destroy --env staging --name "FOO"
npx begin env destroy --env staging --name "FOO"
Local development
When working in your local development environment, environment variables must be provided by a .env
file within your project. One environment variable can be declared per line in the file, with the key and value separated by an equals (=
) sign. For example:
FOO=bar
API_KEY=super-secret