diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java index 19570f51c1a64..4daa4408e9cfd 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java @@ -161,13 +161,12 @@ private static class BrokerStarter { } // worker talks to local broker boolean useTls = workerConfig.isUseTls(); - String localhost = "127.0.0.1"; String pulsarServiceUrl = useTls - ? PulsarService.brokerUrlTls(localhost, brokerConfig.getBrokerServicePortTls().get()) - : PulsarService.brokerUrl(localhost, brokerConfig.getBrokerServicePort().get()); + ? PulsarService.brokerUrlTls(brokerConfig) + : PulsarService.brokerUrl(brokerConfig); String webServiceUrl = useTls - ? PulsarService.webAddressTls(localhost, brokerConfig.getWebServicePortTls().get()) - : PulsarService.webAddress(localhost, brokerConfig.getWebServicePort().get()); + ? PulsarService.webAddressTls(brokerConfig) + : PulsarService.webAddress(brokerConfig); workerConfig.setPulsarServiceUrl(pulsarServiceUrl); workerConfig.setPulsarWebServiceUrl(webServiceUrl); String hostname = ServiceConfigurationUtils.getDefaultOrConfiguredAddress( diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java index 7fa0d8cd4a820..7fdb3c9f5dc76 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java @@ -273,13 +273,12 @@ public void start() throws Exception { } // worker talks to local broker boolean useTls = workerConfig.isUseTls(); - String localhost = "127.0.0.1"; String pulsarServiceUrl = useTls - ? PulsarService.brokerUrlTls(localhost, config.getBrokerServicePortTls().get()) - : PulsarService.brokerUrl(localhost, config.getBrokerServicePort().get()); + ? PulsarService.brokerUrlTls(config) + : PulsarService.brokerUrl(config); String webServiceUrl = useTls - ? PulsarService.webAddressTls(localhost, config.getWebServicePortTls().get()) - : PulsarService.webAddress(localhost, config.getWebServicePort().get()); + ? PulsarService.webAddressTls(config) + : PulsarService.webAddress(config); workerConfig.setPulsarServiceUrl(pulsarServiceUrl); workerConfig.setPulsarWebServiceUrl(webServiceUrl); if (this.isNoStreamStorage()) {