2d4087fac6b5f6137e9abd2e494b2d49a10a099c
[nonrtric.git] / enrichment-coordinator-service / src / main / java / org / oransc / enrichment / configuration / ApplicationConfig.java
1 /*-
2  * ========================LICENSE_START=================================
3  * O-RAN-SC
4  * %%
5  * Copyright (C) 2020 Nordix Foundation
6  * %%
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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===================================
19  */
20
21 package org.oransc.enrichment.configuration;
22
23 import javax.validation.constraints.NotEmpty;
24
25 import lombok.Getter;
26
27 import org.springframework.beans.factory.annotation.Value;
28 import org.springframework.boot.context.properties.ConfigurationProperties;
29 import org.springframework.boot.context.properties.EnableConfigurationProperties;
30
31 @EnableConfigurationProperties
32 @ConfigurationProperties()
33 public class ApplicationConfig {
34     @NotEmpty
35     @Getter
36     @Value("${app.filepath}")
37     private String localConfigurationFilePath;
38
39     @Value("${server.ssl.key-store-type}")
40     private String sslKeyStoreType = "";
41
42     @Value("${server.ssl.key-store-password}")
43     private String sslKeyStorePassword = "";
44
45     @Value("${server.ssl.key-store}")
46     private String sslKeyStore = "";
47
48     @Value("${server.ssl.key-password}")
49     private String sslKeyPassword = "";
50
51     @Value("${app.webclient.trust-store-used}")
52     private boolean sslTrustStoreUsed = false;
53
54     @Value("${app.webclient.trust-store-password}")
55     private String sslTrustStorePassword = "";
56
57     @Value("${app.webclient.trust-store}")
58     private String sslTrustStore = "";
59
60     public WebClientConfig getWebClientConfig() {
61         return ImmutableWebClientConfig.builder() //
62             .keyStoreType(this.sslKeyStoreType) //
63             .keyStorePassword(this.sslKeyStorePassword) //
64             .keyStore(this.sslKeyStore) //
65             .keyPassword(this.sslKeyPassword) //
66             .isTrustStoreUsed(this.sslTrustStoreUsed) //
67             .trustStore(this.sslTrustStore) //
68             .trustStorePassword(this.sslTrustStorePassword) //
69             .build();
70     }
71
72 }