Skip to content

Commit f3f6ed9

Browse files
committed
added truststore&keystorePasword
1 parent 5275899 commit f3f6ed9

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
@@ -29,8 +29,10 @@ public final class KafkaConfiguration {
2929
private String saslMechanism;
3030
private String securityProtocol;
3131
private String truststoreFile;
32+
private String truststorePassword;
3233
private String propertiesFile;
3334
private String keystoreFile;
35+
private String keystorePassword;
3436

3537
public void applyCommon(Properties properties) {
3638
properties.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, brokerConnect);
@@ -43,12 +45,18 @@ public void applyCommon(Properties properties) {
4345
if (new File(truststoreFile).isFile()) {
4446
LOG.info("Assigning truststore location to {}", truststoreFile);
4547
properties.put("ssl.truststore.location", truststoreFile);
48+
if (truststorePassword != null && !truststorePassword.isEmpty()) {
49+
properties.put("ssl.truststore.password", truststorePassword);
50+
}
4651
}
4752

4853
LOG.info("Checking keystore file {}", keystoreFile);
4954
if (new File(keystoreFile).isFile()) {
5055
LOG.info("Assigning keystore location to {}", keystoreFile);
5156
properties.put("ssl.keystore.location", keystoreFile);
57+
if (keystorePassword != null && !keystorePassword.isEmpty()) {
58+
properties.put("ssl.keystore.password", keystorePassword);
59+
}
5260
}
5361

5462
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)