From c02f1acc2413709a607e66482c78a3c555df0ee3 Mon Sep 17 00:00:00 2001 From: Ambud Date: Fri, 3 May 2019 11:14:49 -0700 Subject: [PATCH] Add bindhost configuration (#132) --- .../main/java/com/pinterest/doctorkafka/DoctorKafkaMain.java | 1 + .../com/pinterest/doctorkafka/config/DoctorKafkaConfig.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/drkafka/src/main/java/com/pinterest/doctorkafka/DoctorKafkaMain.java b/drkafka/src/main/java/com/pinterest/doctorkafka/DoctorKafkaMain.java index c8240075..1890ed3c 100644 --- a/drkafka/src/main/java/com/pinterest/doctorkafka/DoctorKafkaMain.java +++ b/drkafka/src/main/java/com/pinterest/doctorkafka/DoctorKafkaMain.java @@ -109,6 +109,7 @@ private void configureServerRuntime(DoctorKafkaAppConfig configuration, DoctorKa // Configure bind host and port number HttpConnectorFactory application = (HttpConnectorFactory) HttpConnectorFactory.application(); application.setPort(config.getWebserverPort()); + application.setBindHost(config.getWebserverBindHost()); defaultServerFactory.setApplicationConnectors(Collections.singletonList(application)); } diff --git a/drkafka/src/main/java/com/pinterest/doctorkafka/config/DoctorKafkaConfig.java b/drkafka/src/main/java/com/pinterest/doctorkafka/config/DoctorKafkaConfig.java index 46bdc7e0..a753e9b1 100644 --- a/drkafka/src/main/java/com/pinterest/doctorkafka/config/DoctorKafkaConfig.java +++ b/drkafka/src/main/java/com/pinterest/doctorkafka/config/DoctorKafkaConfig.java @@ -42,6 +42,7 @@ public class DoctorKafkaConfig { private static final String WEB_PORT = "web.port"; private static final String NOTIFICATION_EMAILS = "emails.notification"; private static final String ALERT_EMAILS = "emails.alert"; + private static final String WEB_BIND_HOST = "web.bindhost"; private PropertiesConfiguration configuration = null; private AbstractConfiguration drkafkaConfiguration = null; @@ -178,6 +179,10 @@ public long getRestartIntervalInSeconds() { public int getWebserverPort() { return drkafkaConfiguration.getInteger(WEB_PORT, 8080); } + + public String getWebserverBindHost() { + return drkafkaConfiguration.getString(WEB_BIND_HOST, "0.0.0.0"); + } public DoctorKafkaClusterConfig getClusterConfigByZkUrl(String clusterZkUrl) { for (DoctorKafkaClusterConfig clusterConfig : clusterConfigurations.values()) {