Variables


In App Platform, you can use variables to store and pass configuration values such as passwords, file paths, tokens, and other environment parameters.

Types of Variables
Copy link

There are two types of variables: local and global.

Local variables:

  • Are scoped to a single application
  • Are deleted together with the application
  • Are configured when creating or editing an application

Global variables:

  • Are stored separately from applications
  • Can be reused across multiple applications
  • Are managed centrally in App PlatformVariables

Local Variables
Copy link

Local variables can be defined when creating an application or by editing the settings of an existing one.

Creating a Local Variable
Copy link

When creating an Application

You can add local variables during application creation.

  1. Go to App Platform and start creating an application.
  2. In the App settings step, click Add in the Variables section.

55f95d3a 48d3 4781 A878 F0bb0cadf6ec

  1. Enter the variable name and value. To add more variables, click Add More.

894ee047 D580 424b 9def 6eb6cdc0f60c

  1. Enable Save as global if you want this variable to be available to other applications.

You can also upload variables from a file. To do this, click Upload from File and select a .env file. Only files named .env are supported. Variables must be defined in the following format:

APP_NAME=MyApp
APP_ENV=production
DB_HOST=localhost
DB_PORT=3306

In an Existing Application

  1. Go to App Platform and select the application.
  2. Open the Settings tab and click Edit next to Deploy Settings.

371959d8 47a6 42c0 9b1b 9a00a93f0999

  1. In the Variables section, click Add.

Ceffe6bc 5e4f 4783 9d96 Ee873103841b

  1. Enter the variable name and value. To add more variables, click Add More.
  2. Enable Save as global if you want this variable to be available to other applications.

894ee047 D580 424b 9def 6eb6cdc0f60c

Editing a Local Variable
Copy link

  1. Go to App Platform and select the application.
  2. Open the Settings tab and click Edit next to Deploy Settings.

371959d8 47a6 42c0 9b1b 9a00a93f0999

  1. In the Variables section, click the pencil icon next to the variable you want to edit.
  2. Make the changes and save.

Deleting a Local Variable
Copy link

  1. Go to App Platform and select the application.
  2. Open the Settings tab and click Edit next to Deploy Settings.
  3. Click the ✕ icon next to the variable you want to delete.

Global Variables
Copy link

Global variables are managed centrally and are available under App PlatformVariables.

Creating a Global Variable
Copy link

  1. Go to App PlatformVariables and click Add.
  2. Enter the variable name and value. To add more variables, click Add More.
  3. You can also upload variables from a file by clicking Upload from file. Only .env files are supported. Variables must be defined in the following format:
APP_NAME=MyApp
APP_ENV=production
DB_HOST=localhost
DB_PORT=3306

Once added, global variables can be selected when creating a new application or editing an existing one. 

Editing a Global Variable
Copy link

  1. Go to App PlatformVariables.
  2. Click the three-dot menu next to the variable and select Edit.

F807e719 Cf3f 46c3 9fb1 32cff263cc9a

  1. Make the changes and click Save.

Deleting a Global Variable
Copy link

  1. Go to App PlatformVariables.
  2. Click the three-dot menu next to the variable and select Delete.
  3. Confirm the deletion.

If the variable is used by any applications, a list of those applications will be shown. To keep the variable in those applications as a local variable, enable Keep variable as local.

54414636 4d09 45ee 99d0 6aa99fce58a5