feat: add SMTP configuration

This commit is contained in:
Emmanuel BENOîT 2025-01-04 13:06:16 +01:00
parent 46bc60351c
commit 1238b56935
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg
5 changed files with 33 additions and 3 deletions

View file

@ -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

View file

@ -37,6 +37,18 @@ if ! [ -z "$LW_CONFIGURE" ]; then
<property name="username" value="${LW_DB_USER}" />
<property name="password" value="${password}" />
</bean>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${SMTP_HOST}" />
<property name="port" value="${SMTP_PORT}" />
EOF
if [ "$SMTP_AUTH" != "false" ]; then
cat >>data-source.xml <<EOF
<property name="username" value="${SMTP_USER}" />
<property name="password" value="${SMTP_PASSWORD}" />
EOF
fi
cat >>data-source.xml <<EOF
</bean>
</beans>
EOF
fi

View file

@ -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:

View file

@ -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=...

View file

@ -5,8 +5,5 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<import resource="mailer/mailer-bean.xml" />
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="127.0.0.1" />
</bean>
</beans>