Commit b0379639 authored by Quinton.Xu's avatar Quinton.Xu

fix data merge

parent ca6a187b
......@@ -36,7 +36,8 @@ module.exports = {
mergeConfigurations(payload) {
assert(Array.isArray(payload), 'Apollo config should be an array');
try {
const confs = payload.map(pl => pl.data.configurations);
// 从缓存和非缓存获取的response报文不一致
const confs = payload.map(pl => pl.data.configurations || pl.data);
return Object.assign({}, ...confs);
} catch(err) {
assert(err, 'Apollo configs not be merged');
......@@ -52,7 +53,7 @@ module.exports = {
}
return ret;
},
// clientIp这个参数是可选的,用来实现灰度发布。 如果不想传这个参数,请注意URL中从?号开始的query parameters整个都不要出现。
getConfigFromApolloUri(config) {
// 读取环境变量
......
......@@ -25,7 +25,7 @@ describe('#index', function () {
configServerUrl: 'http://example.com',
appId: '<appId>',
clusterName: 'default',
namespaceName: [ 'namespaceName1', 'namespaceName1' ],
namespaceName: [ 'namespaceName1', 'namespaceName2' ],
// clientIp: '',
};
const result = await apollo.remoteConfigServiceFromCache(eggConfig);
......@@ -38,7 +38,7 @@ describe('#index', function () {
configServerUrl: 'http://example.com',
appId: '<appId>',
clusterName: 'default',
namespaceName: [ 'namespaceName1', 'namespaceName1' ],
namespaceName: [ 'namespaceName1', 'namespaceName2' ],
// clientIp: '',
};
const result = await apollo.remoteConfigServiceSikpCache(eggConfig);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment