Last updatedJun 29, 2020

Rate this page:


When you call forge create, we automatically create three environments for you:

  • development
  • staging
  • production

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.

Environment restrictions

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

Environment variables are key-value pairs you can set in each of your app environments (development, staging, production).

  • List your environment variables by running:

    forge variables:list
  • Set a variable with key MY_KEY and value my-value by running:

    forge variables:set MY_KEY my-value
  • Set an encrypted variable by providing the --encrypt option by running:

    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:

    forge variables:unset MY_KEY
  • Read a variable with key MY_KEY in your code as below:


Forge tunnel

When you're using the forge tunnel command, you must prefix environment variables with FORGE_USER_VAR_.

  1. Set the value of MY_KEY by prefixing FORGE_USER_VAR_ to the variable name, then running the following command in your terminal:

    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.

const myVar = process.env.MY_KEY // MY_KEY will be "test"

Rate this page: