fix: send the SMTP password as a secret

This commit is contained in:
Emmanuel BENOîT 2025-01-04 13:24:53 +01:00
parent 1238b56935
commit f2fb65c490
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg
2 changed files with 10 additions and 2 deletions

View file

@ -42,9 +42,14 @@ if ! [ -z "$LW_CONFIGURE" ]; then
<property name="port" value="${SMTP_PORT}" />
EOF
if [ "$SMTP_AUTH" != "false" ]; then
if [ -z "$SMTP_PASSWORD_FILE" ]; then
password="$SMTP_PASSWORD"
else
password="`cat $SMTP_PASSWORD_FILE`"
fi
cat >>data-source.xml <<EOF
<property name="username" value="${SMTP_USER}" />
<property name="password" value="${SMTP_PASSWORD}" />
<property name="password" value="${password}" />
EOF
fi
cat >>data-source.xml <<EOF

View file

@ -38,9 +38,10 @@ services:
SMTP_PORT: ${SMTP_PORT}
SMTP_AUTH: ${SMTP_AUTH}
SMTP_USER: ${SMTP_USER}
SMTP_PASSWORD: ${SMTP_PASSWORD}
SMTP_PASSWORD_FILE: /run/secrets/smtp_password
secrets:
- lw_db_password
- smtp_password
web-main:
build:
@ -73,3 +74,5 @@ secrets:
environment: DB_PASSWORD
lw_db_password:
environment: LW_DB_PASSWORD
smtp_password:
environment: SMTP_PASSWORD