package org.oransc.enrichment.configuration;
-import javax.validation.constraints.NotEmpty;
-
import lombok.Getter;
+import org.oransc.enrichment.configuration.WebClientConfig.HttpProxyConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@EnableConfigurationProperties
@ConfigurationProperties()
public class ApplicationConfig {
- @NotEmpty
- @Getter
- @Value("${app.filepath}")
- private String localConfigurationFilePath;
@Getter
@Value("${app.vardata-directory}")
@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) {
+ 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;
}
}