Skip to content

Commit

Permalink
fix get url from config center (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyann authored Aug 12, 2021
1 parent 021c3f5 commit 14c368b
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ GovernanceConfiguration getDynamicConfiguration() {

if (StringUtils.isNotEmpty(config)) {
Arrays.stream(config.split("\n")).forEach( s -> {
if(s.startsWith(Constants.REGISTRY_ADDRESS)) {
String registryAddress = s.split("=")[1].trim();
if (s.startsWith(Constants.REGISTRY_ADDRESS)) {
String registryAddress = removerConfigKey(s);
registryUrl = formUrl(registryAddress, registryGroup, registryNameSpace, username, password);
} else if (s.startsWith(Constants.METADATA_ADDRESS)) {
metadataUrl = formUrl(s.split("=")[1].trim(), metadataGroup, metadataGroupNameSpace, username, password);
metadataUrl = formUrl(removerConfigKey(s), metadataGroup, metadataGroupNameSpace, username, password);
}
});
}
Expand Down Expand Up @@ -168,6 +168,13 @@ MetaDataCollector getMetadataCollector() {
return metaDataCollector;
}

public static String removerConfigKey(String properties) {
String[] split = properties.split("=");
String[] address = new String[split.length - 1];
System.arraycopy(split, 1, address, 0, split.length - 1);
return String.join("=", address).trim();
}

private URL formUrl(String config, String group, String nameSpace, String username, String password) {
URL url = URL.valueOf(config);
if (StringUtils.isEmpty(url.getParameter(Constants.GROUP_KEY)) && StringUtils.isNotEmpty(group)) {
Expand Down

0 comments on commit 14c368b

Please sign in to comment.