From 1eb6fe0cba4bbecc37ae96461161484c72811fca Mon Sep 17 00:00:00 2001 From: lhameury <lukas.hameury@libriciel.coop> Date: Tue, 2 May 2023 10:29:40 +0200 Subject: [PATCH] Add a way to configure host listening for socket.io --- conf/alfresco-global.properties | 1 + .../iparapheur/repo/notification/socket/SocketServer.java | 7 ++++++- .../resources/alfresco/module/parapheur/module-context.xml | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/conf/alfresco-global.properties b/conf/alfresco-global.properties index 22f17b2..a108acc 100644 --- a/conf/alfresco-global.properties +++ b/conf/alfresco-global.properties @@ -111,6 +111,7 @@ parapheur.jobs.mq.consumer.connector=vm://localhost # WebSocket Port d'ecoute du service de notifications parapheur.notifications.websocketport=8081 +parapheur.notifications.websockethost= ## CDC Fast-Service fastService.repeatIntervalMinutes=30 diff --git a/iparapheur-core/src/main/java/org/adullact/iparapheur/repo/notification/socket/SocketServer.java b/iparapheur-core/src/main/java/org/adullact/iparapheur/repo/notification/socket/SocketServer.java index 4f3f475..50cbc03 100644 --- a/iparapheur-core/src/main/java/org/adullact/iparapheur/repo/notification/socket/SocketServer.java +++ b/iparapheur-core/src/main/java/org/adullact/iparapheur/repo/notification/socket/SocketServer.java @@ -27,6 +27,7 @@ public class SocketServer extends AbstractLifecycleBean { private static Logger logger = Logger.getLogger(SocketServer.class); private String port; + private String host; @Override protected void onBootstrap(ApplicationEvent applicationEvent) { @@ -35,7 +36,7 @@ public class SocketServer extends AbstractLifecycleBean { Configuration config = new Configuration(); config.setPort(Integer.valueOf(port)); - config.setHostname("localhost"); + config.setHostname(host); server = new SocketIOServer(config); server.addListeners(new SocketListener()); @@ -105,4 +106,8 @@ public class SocketServer extends AbstractLifecycleBean { public void setPort(String port) { this.port = port; } + + public void setHost(String host) { + this.host = host; + } } diff --git a/iparapheur-core/src/main/resources/alfresco/module/parapheur/module-context.xml b/iparapheur-core/src/main/resources/alfresco/module/parapheur/module-context.xml index 93b59f5..c8ed5c4 100755 --- a/iparapheur-core/src/main/resources/alfresco/module/parapheur/module-context.xml +++ b/iparapheur-core/src/main/resources/alfresco/module/parapheur/module-context.xml @@ -1460,6 +1460,9 @@ <property name="port"> <value>${parapheur.notifications.websocketport}</value> </property> + <property name="host"> + <value>${parapheur.notifications.websockethost}</value> + </property> </bean> <bean id="schedulerService" class="org.adullact.iparapheur.repo.worker.SchedulerService"> -- GitLab