fix #9910, metadata-report support a separate configuration username and password (#9921)

This commit is contained in:
zhaoguhong 2022-06-14 14:12:29 +08:00 committed by GitHub
parent edd3d282eb
commit 8d9e252ff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -123,9 +123,13 @@ public class MetadataReportConfig extends AbstractConfig {
map.putAll(convert(map, null));
// put the protocol of URL as the "metadata"
map.put("metadata", url.getProtocol());
return new URL("metadata", url.getUsername(), url.getPassword(), url.getHost(),
url.getPort(), url.getPath(), map);
return new URL("metadata",
StringUtils.isBlank(url.getUsername()) ? this.getUsername() : url.getUsername(),
StringUtils.isBlank(url.getPassword()) ? this.getPassword() : url.getPassword(),
url.getHost(),
// address port is priority
this.getPort() == null ? url.getPort() : url.getPort(this.getPort()),
url.getPath(), map);
}
public String getProtocol() {