2 * ========================LICENSE_START=================================
5 * Copyright (C) 2020 Nordix Foundation
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================LICENSE_END===================================
21 package org.oransc.enrichment.configuration;
25 import org.oransc.enrichment.configuration.WebClientConfig.HttpProxyConfig;
26 import org.springframework.beans.factory.annotation.Value;
27 import org.springframework.boot.context.properties.ConfigurationProperties;
28 import org.springframework.boot.context.properties.EnableConfigurationProperties;
30 @EnableConfigurationProperties
31 @ConfigurationProperties()
32 public class ApplicationConfig {
35 @Value("${app.vardata-directory}")
36 private String vardataDirectory;
38 @Value("${server.ssl.key-store-type}")
39 private String sslKeyStoreType = "";
41 @Value("${server.ssl.key-store-password}")
42 private String sslKeyStorePassword = "";
44 @Value("${server.ssl.key-store}")
45 private String sslKeyStore = "";
47 @Value("${server.ssl.key-password}")
48 private String sslKeyPassword = "";
50 @Value("${app.webclient.trust-store-used}")
51 private boolean sslTrustStoreUsed = false;
53 @Value("${app.webclient.trust-store-password}")
54 private String sslTrustStorePassword = "";
56 @Value("${app.webclient.trust-store}")
57 private String sslTrustStore = "";
59 @Value("${app.webclient.http.proxy-host:\"\"}")
60 private String httpProxyHost = "";
62 @Value("${app.webclient.http.proxy-port:0}")
63 private int httpProxyPort = 0;
65 private WebClientConfig webClientConfig = null;
67 public WebClientConfig getWebClientConfig() {
68 if (this.webClientConfig == null) {
69 HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
70 .httpProxyHost(this.httpProxyHost) //
71 .httpProxyPort(this.httpProxyPort) //
73 this.webClientConfig = ImmutableWebClientConfig.builder() //
74 .keyStoreType(this.sslKeyStoreType) //
75 .keyStorePassword(this.sslKeyStorePassword) //
76 .keyStore(this.sslKeyStore) //
77 .keyPassword(this.sslKeyPassword) //
78 .isTrustStoreUsed(this.sslTrustStoreUsed) //
79 .trustStore(this.sslTrustStore) //
80 .trustStorePassword(this.sslTrustStorePassword) //
81 .httpProxyConfig(httpProxyConfig) //
84 return this.webClientConfig;