You can extract a large number of parameters and variables that are generated during application development and import the data to a configuration file for unified management and O&M. When you run code, you can obtain the required variables and parameters from the configuration file. This way, you can quickly modify variables and parameters and reduce code maintenance costs. This topic describes how to create, import, and export a configuration file in the Serverless App Engine (SAE) console.

Background information

The configuration file that is created in this topic is suitable for application development and maintenance scenarios. For information about how to create a ConfigMap that is related to container runtime environments, see Manage a Kubernetes ConfigMap.
Note
  • You must manage configurations in the SAE console and integrate SDKs to read configurations. For more information, see SDK introduction.
  • Application Configuration Management (ACM) that is supported by SAE is discontinued. This does not affect the distributed configuration management feature of SAE. We recommend that you use MSE Nacos 2.0 to manage configurations. For more information, see Edition features.

Create a configuration file

  1. Log on to the SAE console.
  2. In the left-side navigation pane, choose Distributed Configuration Management > Configurations.
  3. In the top navigation bar, select a region.
  4. On the Configurations page, select a namespace and click Create Configuration.
  5. In the Create Configuration panel, configure the parameters and click Create.
    Note The data model of a configuration file is in the <Namespace+Data ID+Group,Content> format. You can specify custom values for the Data ID and Group parameters. The values of the Data ID and Group parameters of a configuration file must be unique in a namespace. The configuration files in different namespaces are isolated from each other.
    ParameterDescription
    Data IDThe ID of the configuration file. To ensure that the ID is globally unique, specify an ID in a format that follows the package.class naming convention. Example: com.taobao.tc.refund.log.level. We recommend that you set the class parameter to an informative value.
    GroupThe name of the configuration group. To ensure that the group name is globally unique, we recommend that you specify a group name in the <Product name>:<Module name> format. You can perform authentication by group.
    Data encryptionSpecifies whether to encrypt the configuration data. If your configurations contain sensitive data, we recommend that you enable the data encryption feature to prevent the sensitive data from being leaked.
    Important Before you enable the data encryption feature, you must activate Key Management Service (KMS) and grant ACM the permissions to use KMS for data encryption and decryption. The Data ID of an encrypted configuration file starts with cipher-. For more information, see Create and use an encrypted configuration file.
    Configuration FormatThe format of the configuration file content. SAE verifies data based on the format that you select. By default, TEXT is selected.
    Configuration ContentThe content of the configuration file. We recommend that you specify a value that does not exceed 10 KB in length. The maximum size of the content can be 100 KB.
    Configuration DescriptionThe description of the configuration file.
    More Configuration
    ApplicationThe name of the application to which the configuration file belongs.
    LabelThe labels. You can manage configuration files by label. You can add up to five labels. Each label can contain up to 64 characters.
    After you create a configuration file, you can view the configuration file on the Configurations page.

Import or export a configuration file

SAE allows you to import or export configuration files across namespaces. This way, you can reuse configurations.

  1. Log on to the SAE console.
  2. In the left-side navigation pane, choose Distributed Configuration Management > Configurations.
  3. In the top navigation bar, select a region.
  4. In the upper part of the Configurations page, select the namespace to which the configuration file that you want to manage belongs.
  5. Import or export a configuration file in the selected namespace based on your business requirements.
    • Import a configuration file
      1. Click Import configuration. In the Import configuration dialog box, select an operation that is performed on the same configuration file from the Same configuration drop-down list, and then click Upload a file.
      2. In the dialog box that appears, select the configuration file that you decompressed and click Open. In the Import configuration dialog box, click Import.
    • Export a configuration file
      1. Find the configuration file that you want to export and click Export in the Operation column. In the Export configuration dialog box, click Export.
      2. Decompress the exported configuration file.