Make rest-client request timeout in model-loader configurable
[aai/model-loader.git] / src / main / java / org / onap / aai / modelloader / restclient / AaiRestClient.java
index 27db741..40aeacc 100644 (file)
@@ -156,13 +156,19 @@ public class AaiRestClient {
 
     private RestClient setupClient() {
         RestClient restClient = new RestClient();
-
-        // @formatter:off
         restClient.validateServerHostname(false)
                 .validateServerCertChain(false)
+                .connectTimeoutMs(config.getClientConnectTimeoutMs())
+                .readTimeoutMs(config.getClientReadTimeoutMs());
+
+        //Use certs only if SSL is enabled
+        if (config.useHttpsWithAAI())
+        {// @formatter:off
+            restClient
                 .clientCertFile(config.getAaiKeyStorePath())
                 .clientCertPassword(config.getAaiKeyStorePassword());
-        // @formatter:on
+            // @formatter:on
+        }
 
         if (useBasicAuth()) {
             restClient.authenticationMode(RestAuthenticationMode.SSL_BASIC);