You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2020/09/02 06:27:41 UTC

[incubator-pinot] 01/01: Add port to swagger ui

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 23a2ca2cd0a269b6ba65dd670f69f11f997f8dd0
Author: Jack Li(Analytics Engineering) <jl...@jlli-mn1.linkedin.biz>
AuthorDate: Tue Sep 1 23:27:13 2020 -0700

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

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..78f9afc 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;
 
@@ -111,7 +112,7 @@ public class ControllerAdminApiApplication extends ResourceConfig {
     Preconditions.checkNotNull(listenerConfigs);
 
     // The URI is irrelevant since the default listener will be manually rewritten.
-    _httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create("http://0.0.0.0/"), this, false);
+    _httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create("http://0.0.0.0:9000/"), this, false);
 
     // Listeners cannot be configured with the factory. Manual overrides is required as instructed by Javadoc.
     _httpServer.removeListener("grizzly");
@@ -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-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org