Dynamic configuration lets you quickly export and import configurations. You can export configurations to create local backups and import configurations to quickly recover them. You can also export and import configurations between different environments.
Export dynamic configurations
Log on to the SOFAStack console.
In the left navigation pane, choose Middleware > Microservice Platform > Microservices > Dynamic Configuration.
On the Dynamic Configuration page, choose More > Export.
The dynamic configuration file is saved in JSON format to the default download folder of your browser.
Import dynamic configurations
On the Dynamic Configuration page, choose More > Import.
Click Browse, select the object file, and then click Open.
You can import dynamic configuration files in JSON and TXT formats.
Dynamic configuration file format
Each line in the dynamic configuration file represents a complete JSON structure for a configuration class. A configuration class can contain multiple properties. The JSON-formatted data for multiple configuration classes is separated by line feeds. The format is as follows:
{
"region":"Alipay",
"appName":"testModel",
"name":"Test Configuration",
"resourceId":"com.alipay.test",
"attributes":[
{
"attributeName":"age",
"name":"Age"
},
{
"attributeName":"name",
"name":"Name"
}
]
}The parameters are described as follows:
Parameter | Description |
region | The namespace of the configuration class. |
appName | The name of the application to which the configuration class belongs. |
resourceId | A string that represents the configuration class. This string must match the ID field of the |
name | The description of the configuration class. |
attributes | The properties of the configuration class:
|
Configuration file example:
[
{
"region":"Alipay",
"appName":"testModel1",
"name":"Configuration class description",
"resourceId":"com.alipay.test",
"attributes":[
{
"attributeName":"age",
"name":"Property description"
},
{
"attributeName":"name",
"name":"Property description"
}
]
},
{
"region":"Alipay",
"appName":"testModel2",
"name":"Configuration class description",
"resourceId":"com.alipay.test",
"attributes":[
{
"attributeName":"age",
"name":"Property description"
},
{
"attributeName":"name",
"name":"Property description"
}
]
}
]