From 1238b5693542b99f5210650995c96d0094f14970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20BENO=C3=8ET?= Date: Sat, 4 Jan 2025 13:06:16 +0100 Subject: [PATCH] feat: add SMTP configuration --- docker/Dockerfile.application | 1 + docker/backend-entrypoint.sh | 12 ++++++++++++ docker/compose.yml | 9 +++++++++ docker/env.example | 11 +++++++++++ .../main/resources/configuration/mailer-beans.xml | 3 --- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.application b/docker/Dockerfile.application index 5c80114..1b83d2b 100644 --- a/docker/Dockerfile.application +++ b/docker/Dockerfile.application @@ -28,6 +28,7 @@ COPY --from=build /src/legacyworlds-server/legacyworlds-server-main/data /app/da ADD docker/backend-entrypoint.sh /app/entrypoint.sh VOLUME /app/state ENTRYPOINT ["/app/entrypoint.sh"] +EXPOSE 9137/tcp 9138/tcp CMD ["server"] FROM tomcat:6.0-jre7 AS tomcat-base diff --git a/docker/backend-entrypoint.sh b/docker/backend-entrypoint.sh index 40724d9..a28aff5 100755 --- a/docker/backend-entrypoint.sh +++ b/docker/backend-entrypoint.sh @@ -37,6 +37,18 @@ if ! [ -z "$LW_CONFIGURE" ]; then + + + +EOF + if [ "$SMTP_AUTH" != "false" ]; then + cat >>data-source.xml < + +EOF + fi + cat >>data-source.xml < EOF fi diff --git a/docker/compose.yml b/docker/compose.yml index a3083ea..8bedb63 100644 --- a/docker/compose.yml +++ b/docker/compose.yml @@ -34,6 +34,11 @@ services: LW_DB_NAME: ${LW_DB_NAME} LW_DB_USER: ${LW_DB_USER} LW_DB_PASSWORD_FILE: /run/secrets/lw_db_password + SMTP_HOST: ${SMTP_HOST} + SMTP_PORT: ${SMTP_PORT} + SMTP_AUTH: ${SMTP_AUTH} + SMTP_USER: ${SMTP_USER} + SMTP_PASSWORD: ${SMTP_PASSWORD} secrets: - lw_db_password @@ -45,6 +50,8 @@ services: restart: always environment: LW_BACKEND_HOST: backend + ports: + - "8080:8080" web-admin: build: @@ -54,6 +61,8 @@ services: restart: always environment: LW_BACKEND_HOST: backend + ports: + - "8081:8080" volumes: database: diff --git a/docker/env.example b/docker/env.example index a4ae3d3..94ae25b 100644 --- a/docker/env.example +++ b/docker/env.example @@ -7,3 +7,14 @@ LW_DB_NAME=legacyworlds LW_DB_USER=legacyworlds # Legacyworlds database password LW_DB_PASSWORD=... + +# SMTP - Outgoing server +SMTP_HOST=smtp.example.org +# SMTP - Port number +SMTP_PORT=587 +# SMTP - Authenticate to outgoing server? (true/false) +SMTP_AUTH=true +# SMTP - User name +SMTP_USER=... +# SMTP - Password +SMTP_PASSWORD=... diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-mailer/src/main/resources/configuration/mailer-beans.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-mailer/src/main/resources/configuration/mailer-beans.xml index e5e284f..0165681 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-mailer/src/main/resources/configuration/mailer-beans.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-mailer/src/main/resources/configuration/mailer-beans.xml @@ -5,8 +5,5 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - - -