Skip to content

Commit

Permalink
[issue #73]fix config bug for long path (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoYL123 authored and liubao68 committed Dec 11, 2019
1 parent d8fd982 commit bd81e0c
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 141 deletions.
8 changes: 0 additions & 8 deletions script/canary-consumer-feign-hytrix/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions script/canary-consumer-feign-hytrix/start.sh

This file was deleted.

8 changes: 0 additions & 8 deletions script/canary-consumer/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions script/canary-consumer/start.sh

This file was deleted.

8 changes: 0 additions & 8 deletions script/canary-provider-beta/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions script/canary-provider-beta/start.sh

This file was deleted.

8 changes: 0 additions & 8 deletions script/canary-provider/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions script/canary-provider/start.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,40 @@ public ServiceCombConfigClient(String url, HttpTransport httpTransport) {

/**
* load all remote config from config center
*
* @param dimensionsInfo service name + @ + application name
* @return
* @throws RemoteOperationException
*/
public Map<String, String> loadAll(String dimensionsInfo, String project) throws RemoteOperationException {
public Map<String, String> loadAll(String dimensionsInfo, String project)
throws RemoteOperationException {
Response response = null;
Map<String, String> result = new HashMap<>();
try {
project = project != null && !project.isEmpty() ? project : ConfigConstants.DEFAULT_PROJECT;
response = httpTransport.sendGetRequest(
url + "/" + ConfigConstants.DEFAULT_API_VERSION + "/" + project + "/configuration/items?dimensionsInfo="
url + "/" + ConfigConstants.DEFAULT_API_VERSION + "/" + project
+ "/configuration/items?dimensionsInfo="
+ URLEncoder.encode(dimensionsInfo, "UTF-8"));
if (response == null) {
return result;
}
if (response.getStatusCode() == HttpStatus.SC_OK) {
ObjectMapper objectMapper = new ObjectMapper();
LOGGER.debug(response.getContent());
Map<String, Map<String, String>> allConfigMap = objectMapper.readValue(response.getContent(), HashMap.class);
Map<String, Map<String, String>> allConfigMap = objectMapper
.readValue(response.getContent(), HashMap.class);
if (allConfigMap != null) {
if (allConfigMap.get(ConfigConstants.APPLICATION_CONFIG) != null) {
result.putAll(allConfigMap.get(ConfigConstants.APPLICATION_CONFIG));
}
if (allConfigMap
.get(dimensionsInfo.substring(0, dimensionsInfo.indexOf(ConfigConstants.DEFAULT_SERVICE_SEPARATOR)))
if (dimensionsInfo.contains(ConfigConstants.DEFAULT_SERVICE_SEPARATOR)
&& allConfigMap.get(dimensionsInfo
.substring(0, dimensionsInfo.indexOf(ConfigConstants.DEFAULT_SERVICE_SEPARATOR)))
!= null) {
result.putAll(allConfigMap
.get(dimensionsInfo.substring(0, dimensionsInfo.indexOf(ConfigConstants.DEFAULT_SERVICE_SEPARATOR))));
.get(dimensionsInfo.substring(0,
dimensionsInfo.indexOf(ConfigConstants.DEFAULT_SERVICE_SEPARATOR))));
}
if (allConfigMap.get(dimensionsInfo) != null) {
result.putAll(allConfigMap.get(dimensionsInfo));
Expand All @@ -90,7 +96,8 @@ public Map<String, String> loadAll(String dimensionsInfo, String project) throws
return null;
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";mesage=" + response.getStatusMessage());
"read response failed. status=" + response.getStatusCode() + ";mesage=" + response
.getStatusMessage());
}
} catch (RemoteServerUnavailableException e) {
throw new RemoteOperationException("build url failed.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:
servicecomb:
discovery:
enabled: true
address: http://127.0.0.1:30100
address: ${engineAdd:https://cse.cn-north-4.myhuaweicloud.com}
version: 0.0.2
healthCheckInterval: 30
autoDiscovery: true
Expand All @@ -19,48 +19,11 @@ feign:
servicecomb:
routeRule:
canary-provider: |
- precedence: 2 #优先级
match: #匹配策略
source: consumer #匹配某个服务名
headers: #header匹配
xx:
regex: xx
caseInsensitive: false #是否区分大小写,默认为false,区分大小写
x:
exact: x
- precedence: 1 #优先级
route: #路由规则
- weight: 50
- weight: 80
tags:
version: 0.0.1
- weight: 20
tags:
version: 0.0.2
- precedence: 1
match:
source: 1 #匹配某个服务名
headers: #header匹配
xx:
regex: xx
caseInsensitive: false # 是否区分大小写,默认为false,区分大小写
xxx:
exact: xx
route:
- weight: 1
tags:
version: 1
app: a
moke2: |
- precedence: 1
match:
source: xx #匹配某个服务名
headers: #header匹配
xx:
regex: xx
caseInsensitive: false # 是否区分大小写,默认为false,区分大小写
xxx:
exact: xx
route:
- weight: 1
tags:
version: 1
app: 1
version: 0.0.2
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ spring:
servicecomb:
discovery:
enabled: true
address: https://cse.cn-north-4.myhuaweicloud.com:443
address: ${engineAdd:https://cse.cn-north-4.myhuaweicloud.com}
version: 0.0.2
healthCheckInterval: 30
# autoDiscovery: true
credentials:
enable: true
accessKey: yourak
secretKey: yoursk
project: cn-north-4
enable: ${sslEnabled:true}
accessKey: ${ak:yourak}
secretKey: ${sk:yoursk}
project: ${region:cn-north-4}
akskCustomCipher: default

servicecomb:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ spring:
cloud:
servicecomb:
config:
serverAddr: https://cse.cn-north-4.myhuaweicloud.com
serverAddr: ${engineAdd:https://cse.cn-north-4.myhuaweicloud.com}
watch:
delay: 10000
credentials:
enable: true
accessKey: yourak
secretKey: yoursk
akskCustomCipher: default
project: cn-north-4
enable: ${sslEnabled:true}
accessKey: ${ak:yourak}
secretKey: ${sk:yoursk}
project: ${region:cn-north-4}
akskCustomCipher: default
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ spring:
servicecomb:
discovery:
enabled: true
address: https://cse.cn-north-4.myhuaweicloud.com:443
address: ${engineAdd:https://cse.cn-north-4.myhuaweicloud.com}
version: 0.0.2
healthCheckInterval: 30
credentials:
enable: true
accessKey: yourak
secretKey: yoursk
project: cn-north-4
enable: ${sslEnabled:true}
accessKey: ${ak:yourak}
secretKey: ${sk:yoursk}
project: ${region:cn-north-4}
akskCustomCipher: default
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ spring:
servicecomb:
discovery:
enabled: true
address: https://cse.cn-north-4.myhuaweicloud.com:443
address: ${engineAdd:https://cse.cn-north-4.myhuaweicloud.com}
version: 0.1.1
healthCheckInterval: 30
credentials:
enable: true
accessKey: yourak
secretKey: yoursk
project: cn-north-4
enable: ${sslEnabled:true}
accessKey: ${ak:yourak}
secretKey: ${sk:yoursk}
project: ${region:cn-north-4}
akskCustomCipher: default

0 comments on commit bd81e0c

Please sign in to comment.