Rate this page:
set an environment variable
Usage: forge variables set [options] [key] [value]
--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
The command allows you to set app-specific environment variables for each environment in which the app is run. Forge provides a , , and environment for each app, but you can create more environments through .
When you run without an environment option ( or ), 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.
forge variables set EXT_SERVICE_PORT 3000
This command stores the value for the key (in cleartext) in your app's Forge environment variables. Since no environment () is specified, the environment variable will be stored in your default environment.
forge variables set --encrypt --environment production EXT_SERVICE_KEY "jIexOA3wwT8gRJlP"
This command encrypts then stores the value for the key in the app's Forge environment variables for the environment. The value is received by Atlassian in cleartext and encrypted on Atlassian's servers before storage.
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: