Rate this page:
When you call forge create
, we automatically create three environments for you:
Environments are where you deploy your app. Once an app is running in an environment,
you can install it from that environment on to an Atlassian site with forge install
.
We recommend using the development environment for testing your changes, staging for a stable version of your app, and production as the version of your app that’s ready for use.
By default, the CLI will run commands for the development environment unless you specify
another with the --environment
flag.
While your app is deployed to development, your app title will have the suffix (DEVELOPMENT)
.
Similarly, while your app is deployed to staging, it will have the suffix (STAGING)
.
Once you deploy your app to production, your app title will no longer have any suffix.
When using the staging environment, you can't use the forge tunnel
command. You'll need
to redeploy your app using forge deploy
each time you make a code change.
In the production environment, you can't use the forge tunnel
or forge logs
commands.
To debug issues in a production environment, you’ll need to redeploy your affected code to the staging or development environments where you have access to debugging tools. See the Debugging page for more detail.
Environment variables are key-value pairs you can set in each of your app environments (development, staging, production).
Note, environment variables cannot be accessed in the snapshot context.
List your environment variables by running:
1
forge variables:list
Set a variable with key MY_KEY and value my-value by running:
1
forge variables:set MY_KEY my-value
Set an encrypted variable by providing the --encrypt
option by running:
1
forge variables:set --encrypt MY_KEY my-value
Encrypted values are protected from forge variables:list
output. However, they are
passed to your app's environment as clear text.
Unset a variable with key MY_KEY by running:
1
forge variables:unset MY_KEY
Read a variable with key MY_KEY in your code as below:
1
process.env.MY_KEY
When you're using the forge tunnel
command, you must prefix environment variables with
FORGE_USER_VAR_
.
Set the value of MY_KEY
by prefixing FORGE_USER_VAR_
to the variable name, then
running the following command in your terminal:
1
export FORGE_USER_VAR_MY_KEY=test
You do not need to change variable assignment when using environment variables with forge tunnel
,
the variable is still accessed with MY_KEY
.
1
const myVar = process.env.MY_KEY // MY_KEY will be "test"
Rate this page: