There was no override of properties related to HttpClientConfig, whic… (#2120)

* There was no override of properties related to HttpClientConfig, which meant that if a property wasn't present in global-properties files, it wouldn't be registered and couldn't be provided through command line. I've amended that here
This commit is contained in:
Marcin Strankowski
2023-08-07 19:43:38 +02:00
committed by GitHub
parent e5886e2104
commit 6ba66513f2

View File

@@ -85,17 +85,27 @@ public class HttpClientConfig
this.keyStore = new AlfrescoKeyStoreImpl(sslEncryptionParameters.getKeyStoreParameters(), keyResourceLoader); this.keyStore = new AlfrescoKeyStoreImpl(sslEncryptionParameters.getKeyStoreParameters(), keyResourceLoader);
this.trustStore = new AlfrescoKeyStoreImpl(sslEncryptionParameters.getTrustStoreParameters(), keyResourceLoader); this.trustStore = new AlfrescoKeyStoreImpl(sslEncryptionParameters.getTrustStoreParameters(), keyResourceLoader);
config = retrieveConfig(serviceName); config = retrieveConfig();
checkUnsupportedProperties(config); checkUnsupportedProperties(config);
} }
/** /**
* Method used for retrieving HttpClient config from Global Properties * Method used for retrieving HttpClient config from Global Properties
* @param serviceName name of used service * that can also have values provided/overridden through System Properties
*
* @return map of properties * @return map of properties
*/ */
private Map<String, String> retrieveConfig(String serviceName) private Map<String, String> retrieveConfig()
{ {
Map<String, String> resultProperties = getHttpClientPropertiesForService(properties);
Map<String, String> systemProperties = getHttpClientPropertiesForService(System.getProperties());
systemProperties.forEach((k, v) -> resultProperties.put(k, v)); //Override/Add to Global Properties results with values from System Properties
return resultProperties;
}
private Map<String, String> getHttpClientPropertiesForService(Properties properties) {
return properties.keySet().stream() return properties.keySet().stream()
.filter(key -> key instanceof String) .filter(key -> key instanceof String)
.map(Object::toString) .map(Object::toString)