This is an automated email from the ASF dual-hosted git repository.

jlli pushed a commit to branch add-port-to-swagger
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit d364c1495b2fbb3c2c3ca8c303dfa89b4aeb4b24
Author: Jack Li(Analytics Engineering) <j...@jlli-mn1.linkedin.biz>
AuthorDate: Tue Sep 1 23:27:13 2020 -0700

    Add port to swagger ui
---
 .../pinot/controller/api/ControllerAdminApiApplication.java       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
index 1684868..2d1d335 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
@@ -24,6 +24,7 @@ import java.net.URI;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.UnknownHostException;
+import java.util.Collection;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -152,7 +153,12 @@ public class ControllerAdminApiApplication extends 
ResourceConfig {
     beanConfig.setResourcePackage(RESOURCE_PACKAGE);
     beanConfig.setScan(true);
     try {
-      beanConfig.setHost(InetAddress.getLocalHost().getHostName());
+      Collection<NetworkListener> listeners = httpServer.getListeners();
+      if (listeners.size() > 0) {
+        // fetch the port from the first listener which uses http
+        int port = listeners.iterator().next().getPort();
+        beanConfig.setHost(InetAddress.getLocalHost().getHostName() + ":" + 
port);
+      }
     } catch (UnknownHostException e) {
       throw new RuntimeException("Cannot get localhost name");
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to