Updated on 2023-06-25 GMT+08:00

Configuring Environment Variables of a Component

Environment variables are set in the container running environment and can be modified after application component deployment, ensuring the flexibility of applications.

This section describes how to configure environment variables during deployment using CCE and VM.

CCE

If Cloud Container Engine is selected for Deployment System on the Configure Basic Settings page during component deployment, add environment variables by referring to the following steps.

  1. On the Configure Component page, choose Advanced Settings > Component Configuration.
  2. Add environment variables by referring to Table 1.

    Currently, environment variables can be added using any of the following methods:
    Table 1 Environment variable types

    Environment Variable Type

    Procedure

    Add manually

    1. Click Add Environment Variable and select Add manually.
    2. Set Name and Variable/Variable Reference to add an environment variable.

    Add from secret

    1. Create a secret. For details, see Creating a Secret.
    2. Click Add Environment Variable and select Add from secret.
    3. Set Name.
    4. Optional: Select a secret from the Variable/Variable Reference drop-down list.

    Add from ConfigMap

    1. Create a configuration item. For details, see Creating a Configuration Item.
    2. Click Add Environment Variable and select Add from ConfigMap.
    3. Enter Name.
    4. Select a configuration item from the Variable/Variable Reference drop-down list.

    Import

    Click Import and select a local configuration file.

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

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

VM

If VM is selected for Deployment System on the Configure Basic Settings page during component deployment, add environment variables by referring to the following steps.

  1. On the Configure Component page, click Add Environment Variable.
  2. Set Key and Value, and click OK.