89374649954709887f8a714842315390f8beff14
[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     @Getter
40     @Value("${app.vardata-directory}")
41     private String vardataDirectory;
42
43     @Value("${server.ssl.key-store-type}")
44     private String sslKeyStoreType = "";
45
46     @Value("${server.ssl.key-store-password}")
47     private String sslKeyStorePassword = "";
48
49     @Value("${server.ssl.key-store}")
50     private String sslKeyStore = "";
51
52     @Value("${server.ssl.key-password}")
53     private String sslKeyPassword = "";
54
55     @Value("${app.webclient.trust-store-used}")
56     private boolean sslTrustStoreUsed = false;
57
58     @Value("${app.webclient.trust-store-password}")
59     private String sslTrustStorePassword = "";
60
61     @Value("${app.webclient.trust-store}")
62     private String sslTrustStore = "";
63
64     public WebClientConfig getWebClientConfig() {
65         return ImmutableWebClientConfig.builder() //
66             .keyStoreType(this.sslKeyStoreType) //
67             .keyStorePassword(this.sslKeyStorePassword) //
68             .keyStore(this.sslKeyStore) //
69             .keyPassword(this.sslKeyPassword) //
70             .isTrustStoreUsed(this.sslTrustStoreUsed) //
71             .trustStore(this.sslTrustStore) //
72             .trustStorePassword(this.sslTrustStorePassword) //
73             .build();
74     }
75
76 }