2 * ============LICENSE_START======================================================================
3 * Copyright (C) 2018, 2020-2022 Nokia. All rights reserved.
4 * Copyright (C) 2018-2019 Nordix Foundation. All rights reserved.
5 * ===============================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7 * in compliance with the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software distributed under the License
12 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 * or implied. See the License for the specific language governing permissions and limitations under
15 * ============LICENSE_END========================================================================
18 package org.onap.dcaegen2.collectors.datafile.configuration;
20 import java.util.Properties;
24 import org.springframework.beans.factory.annotation.Value;
25 import org.springframework.boot.context.properties.EnableConfigurationProperties;
26 import org.springframework.stereotype.Component;
29 * Holds all configuration for the DFC.
31 * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on
33 * @author <a href="mailto:henrik.b.andersson@est.tech">Henrik Andersson</a>
37 @EnableConfigurationProperties
38 public class AppConfig {
40 @Value("#{systemEnvironment}")
41 Properties systemEnvironment;
43 @Value("${app.kafka.bootstrap-servers:}")
44 private String kafkaBootStrapServers;
46 @Value("${app.kafka.collected-file-topic:}")
47 public String collectedFileTopic;
49 @Value("${app.kafka.file-ready-event-topic:}")
50 public String fileReadyEventTopic;
52 @Value("${app.kafka.client-id:undefined}")
53 public String kafkaClientId;
55 @Value("${app.collected-files-path:}")
56 public String collectedFilesPath;
58 @Value("${app.sftp.strict-host-key-checking:false}")
59 public boolean strictHostKeyChecking;
61 @Value("${app.sftp.known-hosts-file-path:}")
62 public String knownHostsFilePath;
64 @Value("${app.ssl.key-store-password-file}")
65 private String clientKeyStorePassword = "";
67 @Value("${app.ssl.key-store:}")
68 private String clientKeyStore = "";
70 @Value("${app.ssl.trust-store:}")
71 private String clientTrustStore = "";
73 @Value("${app.ssl.trust-store-password-file:}")
74 private String clientTrustStorePassword;
77 @Value("${app.s3.endpointOverride:}")
78 private String s3EndpointOverride;
81 @Value("${app.s3.accessKeyId:}")
82 private String s3AccessKeyId;
85 @Value("${app.s3.secretAccessKey:}")
86 private String s3SecretAccessKey;
89 @Value("${app.s3.bucket:}")
90 private String s3Bucket;
92 @Value("${app.s3.locksBucket:}")
93 private String s3LocksBucket;
95 @Value("${app.number-of-worker-treads:200}")
97 private int noOfWorkerThreads;
99 public String getS3LocksBucket() {
100 return s3LocksBucket.isEmpty() ? s3Bucket : s3LocksBucket;
103 public boolean isS3Enabled() {
104 return !s3EndpointOverride.isEmpty() && !s3Bucket.isEmpty();
107 public String getKafkaBootStrapServers() {
108 return kafkaBootStrapServers;
111 public synchronized CertificateConfig getCertificateConfiguration() {
112 return CertificateConfig.builder() //
113 .trustedCa(this.clientTrustStore) //
114 .trustedCaPasswordPath(this.clientTrustStorePassword) //
115 .keyCert(this.clientKeyStore) //
116 .keyPasswordPath(this.clientKeyStorePassword) //
120 public synchronized SftpConfig getSftpConfiguration() {
121 return SftpConfig.builder() //
122 .knownHostsFilePath(this.knownHostsFilePath) //
123 .strictHostKeyChecking(this.strictHostKeyChecking) //