Skip to content

Commit 1aeef69

Browse files
committed
added truststore&keystorePasword
1 parent 943b0c8 commit 1aeef69

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/kafdrop/config/KafkaConfiguration.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ public final class KafkaConfiguration {
2525
private String saslMechanism;
2626
private String securityProtocol;
2727
private String truststoreFile;
28+
private String truststorePassword;
2829
private String propertiesFile;
2930
private String keystoreFile;
31+
private String keystorePassword;
3032

3133
public void applyCommon(Properties properties) {
3234
properties.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, brokerConnect);
@@ -39,12 +41,18 @@ public void applyCommon(Properties properties) {
3941
if (new File(truststoreFile).isFile()) {
4042
LOG.info("Assigning truststore location to {}", truststoreFile);
4143
properties.put("ssl.truststore.location", truststoreFile);
44+
if (truststorePassword != null && !truststorePassword.isEmpty()) {
45+
properties.put("ssl.truststore.password", truststorePassword);
46+
}
4247
}
4348

4449
LOG.info("Checking keystore file {}", keystoreFile);
4550
if (new File(keystoreFile).isFile()) {
4651
LOG.info("Assigning keystore location to {}", keystoreFile);
4752
properties.put("ssl.keystore.location", keystoreFile);
53+
if (keystorePassword != null && !keystorePassword.isEmpty()) {
54+
properties.put("ssl.keystore.password", keystorePassword);
55+
}
4856
}
4957

5058
LOG.info("Checking properties file {}", propertiesFile);

src/main/resources/application.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ kafka:
4141
saslMechanism: "PLAIN"
4242
securityProtocol: "SASL_PLAINTEXT"
4343
truststoreFile: "${KAFKA_TRUSTSTORE_FILE:kafka.truststore.jks}"
44-
propertiesFile : "${KAFKA_PROPERTIES_FILE:kafka.properties}"
4544
keystoreFile: "${KAFKA_KEYSTORE_FILE:kafka.keystore.jks}"
45+
propertiesFile: "${KAFKA_PROPERTIES_FILE:kafka.properties}"
46+
truststorePassword: "${KAFKA_TRUSTSTORE_PASSWORD}"
47+
keystorePassword: "${KAFKA_KEYSTORE_PASSWORD}"

0 commit comments

Comments
 (0)