feature/undertow #4

Merged
manuel merged 15 commits from feature/undertow into master 2023-04-08 22:40:46 +02:00
2 changed files with 3 additions and 17 deletions
Showing only changes of commit 17afb42715 - Show all commits

View file

@ -25,14 +25,8 @@ public class LabyrinthServer {
@NonNull
private final Undertow undertow;
public static Option<LabyrinthServer> createAndStartServer() {
final Option<LabyrinthServer> serverOption = Try.of(ServerConfig::init)
.mapTry(LabyrinthServer::new)
.onFailure(cause -> log.error(
"Failed to create LabyrinthServer.",
cause
))
.toOption();
public static Try<LabyrinthServer> createAndStartServer() {
final Try<LabyrinthServer> serverOption = Try.of(ServerConfig::init).mapTry(LabyrinthServer::new);
serverOption.forEach(LabyrinthServer::start);
return serverOption;
}

View file

@ -5,14 +5,6 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class Main {
public static void main(String[] args) {
LabyrinthServer.createAndStartServer().onEmpty(() -> log.error("Failed to create server. Stopping."));
// final ServerConfig config = ServerConfig.init();
// log.info("Starting Server at http://{}:{}/", config.getAddress().getHostAddress(), config.getPort());
// Undertow.builder()
// .addHttpListener(config.getPort(), config.getAddress().getHostAddress())
// .setHandler(UndertowPlayground.r)
// .build()
// .start();
LabyrinthServer.createAndStartServer().onFailure(e -> log.error("Failed to create server. Stopping.", e));
}
}