environments
install
providers
settings
storage
variables

variables set

Description

set an environment variable

Usage

1
2
Usage: forge variables set [options] [key] [value]

Options

1
2
--verbose                        enable verbose mode
--encrypt                        encrypt variable (default: false)
-e, --environment [environment]  specify the environment (see your default
                                 environment by running forge settings list)
-h, --help                       display help for command

Operation

The forge variables set command allows you to set app-specific environment variables for each environment in which the app is run. Forge provides a development, staging, and production environment for each app, but you can create more environments through forge environments create.

When you run forge variables set without an environment option (--environment or -e), the command sets the variables in your default environment. Your default environment is set the first time you run an environment-specific command.

Encrypted Forge environment variables allow you to securely store secrets.

Forge environment variables are useful when your app requires different configurations depending on the environment in which it is running. You can either set the individual configuration parameters in variables for each environment, or configure them in code grouped by the environment name and use a Forge environment variable to select the set of configuration values to use.

Forge environment variables are associated with a single app and environment context. Deploying the app to another environment won’t copy the environment variables across to the new environment context.

Examples

1
2
forge variables set EXT_SERVICE_PORT 3000

This command stores the value 3000 for the key EXT_SERVICE_PORT (in cleartext) in your app's Forge environment variables. Since no environment (--environment) is specified, the environment variable will be stored in your default environment.

1
2
forge variables set --encrypt --environment production EXT_SERVICE_KEY "jIexOA3wwT8gRJlP"

This command encrypts then stores the value jIexOA3wwT8gRJlP for the key EXT_SERVICE_KEY in the app's Forge environment variables for the production environment. The value is received by Atlassian in cleartext and encrypted on Atlassian's servers before storage.

Troubleshooting

If you don't see environment variables that you're certain you've set, check the variables for other environments. Forge uses your default environment if you don't specify one, so variables meant for another environment might have been unintentionally applied there.

Rate this page: