标签:value items boot clu 怎么 yaml ima 一个 接口
官方的解释:什么是“application”的Namespace?Apollo在创建项目的时候,都会默认创建一个“application”的Namespace。顾名思义,“application”是给应用自身使用的,熟悉Spring Boot的同学都知道,Spring Boot项目都有一个默认配置文件application.yml。在这里application.yml就等同于“application”的Namespace。对于90%的应用来说,“application”的Namespace已经满足日常配置使用场景了。
就是一个相当于建立一个独立的配置文件。公共文件只能是properties类型,私有文件类型允许是properties、xml、yml、yaml、json等。
1.创建一个公共的namespace。公共的namespace都是Properties格式,这里的TEST1是项目名称,不可更改
创建一个私有的XML格式的namespace:如果是private支持自定义多种文件格式
给公用namespace添加一个base_name的key
给私有namespace添加数据
* 获取公共文件
$ curl -H ‘Authorization:ab5a901872858535afb48f4da1f7c1c5be522de5‘ -H ‘Content-Type:application/json;charset=UTF-8‘ http://192.168.1.1:8080/openapi/v1/envs/dev/apps/900001/clusters/default/namespaces/Test1.base
{
"appId": "900001",
"clusterName": "default",
"namespaceName": "TEST1.base",
"comment": "基础测试",
"format": "properties",
"isPublic": true,
"items": [
{
"key": "base_name",
"value": "base abc",
"dataChangeCreatedBy": "apollo",
"dataChangeLastModifiedBy": "apollo",
"dataChangeCreatedTime": "2018-07-04T17:31:57.000+0800",
"dataChangeLastModifiedTime": "2018-07-04T17:31:57.000+0800"
}
],
"dataChangeCreatedBy": "apollo",
"dataChangeLastModifiedBy": "apollo",
"dataChangeCreatedTime": "2018-07-04T17:31:35.000+0800",
"dataChangeLastModifiedTime": "2018-07-04T17:31:35.000+0800"
}
$curl -H ‘Authorization:ab5a901872858535afb48f4da1f7c1c5be522de5‘ -H ‘Content-Type:application/json;charset=UTF-8‘ http://192.168.1.1:8080/openapi/v1/envs/dev/apps/900001/clusters/default/namespaces/other.xml
{
"appId": "900001",
"clusterName": "default",
"namespaceName": "other.xml",
"comment": "",
"format": "xml",
"isPublic": false,
"items": [
{
"key": "content",
"value": "<name>apollo.demo</name>",
"dataChangeCreatedBy": "apollo",
"dataChangeLastModifiedBy": "apollo",
"dataChangeCreatedTime": "2018-07-16T10:11:23.000+0800",
"dataChangeLastModifiedTime": "2018-07-16T10:11:23.000+0800"
}
],
"dataChangeCreatedBy": "apollo",
"dataChangeLastModifiedBy": "apollo",
"dataChangeCreatedTime": "2018-07-16T10:04:08.000+0800",
"dataChangeLastModifiedTime": "2018-07-16T10:04:08.000+0800"
}
Apollo配置中心-多组共享配置(关于Namespaces)
标签:value items boot clu 怎么 yaml ima 一个 接口
原文地址:http://blog.51cto.com/brucewang/2143970