Environment variables and app distribution

Hi all,

Let me start by clarifying a few items here:

  • the environment variables are set per app/environment and not per installation/site
  • the environment variables are set by the app developer and not by the customers

This means that, before distributing the app to a customer, the variables will need to be set via the Forge CLI by your team. The app will then be able to access those for all the sites where it is installed.

How to set the environment variables?
Our https://developer.atlassian.com/platform/forge/environments-and-versions/#environment-variables documentation has a few more details but the main commands and flags are:

  • --environment production is the flag to set a variable in the production environment. If not specified, the variable will be set for the development environment which is the default. I’ll add this flag to the commands below considering the previous posts here.
  • forge variables set --environment production MY_KEY my-value for a non encrypted variable
  • forge variables set --encrypt --environment production MY_KEY my-value for an encrypted variable
  • for the CLI to prompt for the options, enter forge variables set --environment production, this can help when entering RSA private keys (based on this other topic)
  • use forge variables list --environment production to check the variables currently set in a specific environment

Hope this helps everybody here,
Caterina

2 Likes