Skip to content

Commit

Permalink
fix: respect HTTP server port configuration in NeonBee options
Browse files Browse the repository at this point in the history
  • Loading branch information
pk-work committed May 19, 2021
1 parent 7871036 commit 4cdbd15
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;

import io.neonbee.NeonBee;
import io.neonbee.config.AuthHandlerConfig;
import io.neonbee.config.EndpointConfig;
import io.neonbee.config.ServerConfig;
Expand Down Expand Up @@ -99,6 +100,10 @@ public void start(Promise<Void> startPromise) {
// the NotFoundHandler fails the routing context finally
router.route().handler(new NotFoundHandler());

// Use the port passed via command line options, instead the configured one.
Optional.ofNullable(NeonBee.get(vertx).getOptions().getServerPort())
.ifPresent(port -> config.setPort(port));

vertx.createHttpServer(config /* ServerConfig is a HttpServerOptions subclass */)
.exceptionHandler(throwable -> {
LOGGER.error("HTTP Socket Exception", throwable);
Expand Down

0 comments on commit 4cdbd15

Please sign in to comment.