You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/11/02 06:07:07 UTC
[servicecomb-java-chassis] branch master updated: [SCB-2111]config
client do not properly handle service scope (#2034)
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new 3bceea5 [SCB-2111]config client do not properly handle service scope (#2034)
3bceea5 is described below
commit 3bceea5a37621562553493f8882266d35484360f
Author: bao liu <bi...@qq.com>
AuthorDate: Mon Nov 2 14:06:57 2020 +0800
[SCB-2111]config client do not properly handle service scope (#2034)
---
.../servicecomb/config/center/client/ConfigCenterClient.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java
index 08c1fd6..c362804 100644
--- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java
+++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java
@@ -53,7 +53,7 @@ public class ConfigCenterClient implements ConfigCenterOperation {
@Override
public QueryConfigurationsResponse queryConfigurations(QueryConfigurationsRequest request) {
- String dimensionsInfo = buildDimensionsInfo(request);
+ String dimensionsInfo = buildDimensionsInfo(request, true);
QueryConfigurationsResponse queryConfigurationsResponse = new QueryConfigurationsResponse();
Map<String, Object> configurations = new HashMap<>();
@@ -61,7 +61,7 @@ public class ConfigCenterClient implements ConfigCenterOperation {
Map<String, String> headers = new HashMap<>();
headers.put("x-environment", request.getEnvironment());
HttpRequest httpRequest = new HttpRequest(addressManager.address() + "/configuration/items?dimensionsInfo="
- + HttpUtils.encodeURLParam(dimensionsInfo) + "&revision=" + request.getRevision(), null, null,
+ + HttpUtils.encodeURLParam(dimensionsInfo) + "&revision=" + request.getRevision(), headers, null,
HttpRequest.GET);
HttpResponse httpResponse = httpTransport.doRequest(httpRequest);
@@ -79,8 +79,8 @@ public class ConfigCenterClient implements ConfigCenterOperation {
configurations.putAll(allConfigMap.get(APPLICATION_CONFIG));
}
- if (allConfigMap.get(request.getServiceName()) != null) {
- configurations.putAll(allConfigMap.get(request.getServiceName()));
+ if (allConfigMap.get(buildDimensionsInfo(request, false)) != null) {
+ configurations.putAll(allConfigMap.get(buildDimensionsInfo(request, false)));
}
if (allConfigMap.get(dimensionsInfo) != null) {
@@ -109,11 +109,11 @@ public class ConfigCenterClient implements ConfigCenterOperation {
}
}
- private String buildDimensionsInfo(QueryConfigurationsRequest request) {
+ private String buildDimensionsInfo(QueryConfigurationsRequest request, boolean withVersion) {
String result =
request.getServiceName() + DEFAULT_APP_SEPARATOR
+ request.getApplication();
- if (!StringUtils.isEmpty(request.getVersion())) {
+ if (withVersion && !StringUtils.isEmpty(request.getVersion())) {
result = result + DEFAULT_SERVICE_SEPARATOR + request
.getVersion();
}