awelsh93 commented on a change in pull request #9938:
URL: https://github.com/apache/druid/pull/9938#discussion_r506382581



##########
File path: 
extensions-contrib/influxdb-emitter/src/main/java/org/apache/druid/emitter/influxdb/InfluxdbEmitter.java
##########
@@ -211,4 +219,46 @@ public void 
transformAndSendToInfluxdb(LinkedBlockingQueue<ServiceMetricEvent> e
     postToInflux(payload.toString());
   }
 
+  private HttpClient buildInfluxdbClient()
+  {
+    if ("https".equals(influxdbEmitterConfig.getProtocol())) {
+      SSLContext sslContext;
+      if (influxdbEmitterConfig.getTrustStorePath() == null || 
influxdbEmitterConfig.getTrustStorePassword() == null) {
+        String msg = "Can't load TrustStore. Truststore path or password is 
not set.";
+        log.error(msg);
+        throw new IllegalStateException(msg);
+      }
+
+      FileInputStream in = null;
+
+      try {
+        in = new FileInputStream(new 
File(influxdbEmitterConfig.getTrustStorePath()));
+        KeyStore store = 
KeyStore.getInstance(influxdbEmitterConfig.getTrustStoreType());
+        store.load(in, 
influxdbEmitterConfig.getTrustStorePassword().toCharArray());
+        TrustManagerFactory tmf = 
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+        tmf.init(store);
+        sslContext = SSLContext.getInstance("TLS");
+        sslContext.init(null, tmf.getTrustManagers(), null);
+      }
+      catch (Exception ex) {
+        String msg = "Unable to load TrustStore";
+        log.error(msg);
+        throw new IllegalStateException(msg);
+      }
+      finally {
+        if (in != null) {

Review comment:
       Thanks for your review - I think I've addressed these comments. Can you 
take another look please?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to