Environment Variables

Each of your Begin app’s environments has its own set of independently configurable environment variables.

Creating environment variables

To add your environment variable use the Begin CLI to execute the following command:

begin env create --env staging --name FOO --value bar
b env create --env staging --name FOO --value bar

Editing variables

To modify an existing environment variable, overwrite it with a new variable with the key you want to use.

begin env create --env staging --name FOO --value baz
Successfully created environment variable FOO in 'staging'
b env create --env staging --name FOO --value baz
Successfully created environment variable FOO in 'staging'

Listing environment 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****
b env list --env staging
vanilla-to-ssr (app ID: XXXXXXXX)
└── staging (env ID: STGXXXXX): https://local-fih.begin.app
    └── FOO=b****

Deleting environment variables

To delete a variable, simply run the destroy command:

begin env destroy --env staging --name FOO
Successfully destroyed environment variable FOO in 'staging'
b env destroy --env staging --name FOO
Successfully destroyed environment variable FOO in 'staging'

Using Variables While Developing

When working in your development environment, you may need to provide different environment variables. See our documentation on Local Dev to see how to use environment variables locally.