Added some logging
[nonrtric.git] / enrichment-coordinator-service / src / main / java / org / oransc / enrichment / configuration / ApplicationConfig.java
index 2d4087f..5493fd8 100644 (file)
 
 package org.oransc.enrichment.configuration;
 
-import javax.validation.constraints.NotEmpty;
-
 import lombok.Getter;
 
+import org.oransc.enrichment.configuration.WebClientConfig.HttpProxyConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -31,10 +32,12 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 @EnableConfigurationProperties
 @ConfigurationProperties()
 public class ApplicationConfig {
-    @NotEmpty
+
+    private static final Logger logger = LoggerFactory.getLogger(ApplicationConfig.class);
+
     @Getter
-    @Value("${app.filepath}")
-    private String localConfigurationFilePath;
+    @Value("${app.vardata-directory}")
+    private String vardataDirectory;
 
     @Value("${server.ssl.key-store-type}")
     private String sslKeyStoreType = "";
@@ -57,16 +60,37 @@ public class ApplicationConfig {
     @Value("${app.webclient.trust-store}")
     private String sslTrustStore = "";
 
+    @Value("${app.webclient.http.proxy-host:\"\"}")
+    private String httpProxyHost = "";
+
+    @Value("${app.webclient.http.proxy-port:0}")
+    private int httpProxyPort = 0;
+
+    private WebClientConfig webClientConfig = null;
+
     public WebClientConfig getWebClientConfig() {
-        return ImmutableWebClientConfig.builder() //
-            .keyStoreType(this.sslKeyStoreType) //
-            .keyStorePassword(this.sslKeyStorePassword) //
-            .keyStore(this.sslKeyStore) //
-            .keyPassword(this.sslKeyPassword) //
-            .isTrustStoreUsed(this.sslTrustStoreUsed) //
-            .trustStore(this.sslTrustStore) //
-            .trustStorePassword(this.sslTrustStorePassword) //
-            .build();
+        if (this.webClientConfig == null) {
+            if (this.httpProxyPort == 0) {
+                logger.info("Http proxy is not used");
+            } else {
+                logger.info("Http proxy is used for RAN access {}:{}", httpProxyHost, httpProxyPort);
+            }
+            HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+                .httpProxyHost(this.httpProxyHost) //
+                .httpProxyPort(this.httpProxyPort) //
+                .build();
+            this.webClientConfig = ImmutableWebClientConfig.builder() //
+                .keyStoreType(this.sslKeyStoreType) //
+                .keyStorePassword(this.sslKeyStorePassword) //
+                .keyStore(this.sslKeyStore) //
+                .keyPassword(this.sslKeyPassword) //
+                .isTrustStoreUsed(this.sslTrustStoreUsed) //
+                .trustStore(this.sslTrustStore) //
+                .trustStorePassword(this.sslTrustStorePassword) //
+                .httpProxyConfig(httpProxyConfig) //
+                .build();
+        }
+        return this.webClientConfig;
     }
 
 }