diff --git a/src/main/java/nl/andrewl/railsignalapi/live/tcp_socket/TcpSocketServer.java b/src/main/java/nl/andrewl/railsignalapi/live/tcp_socket/TcpSocketServer.java index 6b13534..65ae260 100644 --- a/src/main/java/nl/andrewl/railsignalapi/live/tcp_socket/TcpSocketServer.java +++ b/src/main/java/nl/andrewl/railsignalapi/live/tcp_socket/TcpSocketServer.java @@ -6,6 +6,7 @@ import nl.andrewl.railsignalapi.live.ComponentUplinkMessageHandler; import nl.andrewl.railsignalapi.model.LinkToken; import nl.andrewl.railsignalapi.service.LinkTokenService; import nl.andrewl.railsignalapi.util.JsonUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.ContextClosedEvent; import org.springframework.context.event.EventListener; @@ -43,6 +44,9 @@ public class TcpSocketServer { private final ServerSocket serverSocket; private final Set linkManagers; + @Value("${rail-signal.live.tcp.port}") + private int port; + private final LinkTokenService tokenService; private final ComponentDownlinkService componentDownlinkService; private final ComponentUplinkMessageHandler uplinkMessageHandler; @@ -59,13 +63,13 @@ public class TcpSocketServer { this.linkManagers = new HashSet<>(); this.serverSocket = new ServerSocket(); serverSocket.setReuseAddress(true); - serverSocket.bind(new InetSocketAddress("localhost", 8081)); + serverSocket.bind(new InetSocketAddress("localhost", port)); } @EventListener(ApplicationReadyEvent.class) public void runServer() { new Thread(() -> { - log.info("Starting TCP Socket for Component links at " + serverSocket.getInetAddress()); + log.info("Starting TCP Socket for Component links at " + serverSocket.getInetAddress() + ":" + port); while (!serverSocket.isClosed()) { try { Socket socket = serverSocket.accept(); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0275ce5..b47e28e 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -5,7 +5,11 @@ spring.jpa.open-in-view=false spring.datasource.hikari.maximum-pool-size=5 spring.datasource.hikari.minimum-idle=1 +spring.thymeleaf.enabled=false + server.port=8080 server.tomcat.threads.max=10 server.tomcat.threads.min-spare=2 server.tomcat.processor-cache=50 + +rail-signal.live.tcp.port=8081