Help Center> ServiceStage> User Guide> Application Management> Managing Application Environment Variables
Updated on 2024-05-28 GMT+08:00

Managing Application Environment Variables

Environment variables are parameters set in the system or user applications. You can obtain the values of environment variables by calling APIs. During deployment, parameters are specified through environment variables instead of in the code, which makes the deployment flexible.

Environment variables added to an application are global environment variables and take effect for all components of the application.

For details about how to add environment variables for a specific component, see Configuring Environment Variables of a Component.

Manually Adding an Application Environment Variable

  1. Log in to ServiceStage.
  2. Choose Application Management.
  3. Click the target application. The Overview page is displayed.
  1. In the navigation pane on the left, click Environment Variables.
  2. Select a created environment from the drop-down list.
  3. Click Add Environment Variable and set Variable Name and Variable/Variable Reference.

    Where,

    • Variable Name is the name of an application environment variable and must be unique.
    • Variable/Variable Reference is the value of the application environment variable.

    For example, set Variable Name to User and Variable/Variable reference to admin. That is, when the program code reads the User environment variable, admin is obtained. For example, you can start subprocesses as the admin user and read files as the admin user. The actual execution effect depends on the code.

  4. Click Submit.

    Figure 1 Manually adding an application environment variable

Importing the Application Environment Variable File

  1. Log in to ServiceStage.
  2. Choose Application Management.
  3. Click the target application. The Overview page is displayed.
  1. In the navigation pane on the left, click Environment Variables.
  2. Select a created environment from the Environment drop-down list.
  3. Click Import and select the environment variable file created locally.

    The file to be imported must be a key-value pair mapping file in JSON or YAML format and in character string format. For example:

    {"key1": "value1", "key2": "value2"}

    Where,

    • key1 and key2 are the names of application environment variables and must be unique.
    • value1 and value2 are the values of application environment variables.

  4. Click Submit.

    Figure 2 Importing the application environment variable file

Editing an Application Environment Variable

  1. Log in to ServiceStage.
  2. Choose Application Management.
  3. Click the target application. The Overview page is displayed.
  1. In the navigation pane on the left, click Environment Variables.
  2. Select a created environment from the Environment drop-down list.
  3. Select the variable to be edited and click Edit in the Operation column.
  4. Reset Variable Name and Variable/Variable Reference.

    • Variable Name is the name of an application environment variable and must be unique.
    • Variable/Variable Reference is the value of the application environment variable.

  5. Click Submit.

    Figure 3 Editing an application environment variable

Deleting an Application Environment Variable

  1. Log in to ServiceStage.
  2. Choose Application Management.
  3. Click the target application. The Overview page is displayed.
  1. In the navigation pane on the left, click Environment Variables.
  2. Select a created environment from the Environment drop-down list.

    • To delete a single application environment variable, select the target variable and click Delete in the Operation column.
      Figure 4 Deleting a single application environment variable
    • To delete application environment variables in batches, select the target variables and click Bulk Delete.
      Figure 5 Deleting application environment variables in batches

  3. In the displayed dialog box, click OK.

Follow-Up Operations

After the application environment variables are changed, you can: