feature/undertow #4
2 changed files with 3 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue