Support SMTP relay configuration
continuous-integration/drone/push Build is passing Details

Hopefully this doesn't bork existing relay configs
This commit is contained in:
decentral1se 2021-06-02 08:24:33 +02:00
parent 8399631c81
commit 9fa2b2d1b7
No known key found for this signature in database
GPG Key ID: 92DAD76BD9567B8A
4 changed files with 26 additions and 1 deletions

View File

@ -32,4 +32,8 @@ SECRET_DB_PASSWORD_VERSION=v1
# SMTP
#COMPOSE_FILE="compose.yml:compose.mailrelay.yml"
#SMTP_HOST="postfix_relay_app"
#SMTP_PORT=587
#SMTP_AUTH=on
#SMTP_TLS=on
#MAIL_FROM="wordpress@example.com"
#SECRET_SMTP_PASSWORD_VERSION=v1

View File

@ -1,7 +1,7 @@
export PHP_UPLOADS_CONF_VERSION=v3
export ENTRYPOINT_CONF_VERSION=v2
export ENTRYPOINT_MAILRELAY_CONF_VERSION=v1
export MSMTP_CONF_VERSION=v1
export MSMTP_CONF_VERSION=v2
sub_wp() {
CONTAINER=$(docker container ls -f "Name=${STACK_NAME}_app" --format '{{ .ID }}')

View File

@ -4,8 +4,13 @@ version: "3.8"
services:
app:
entrypoint: /docker-entrypoint.mailrelay.sh
secrets:
- smtp_password
environment:
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_AUTH=${SMTP_AUTH}
- SMTP_TLS=${SMTP_TLS}
- MAIL_FROM=${MAIL_FROM}
configs:
- source: mstmp_conf
@ -23,3 +28,8 @@ configs:
name: ${STACK_NAME}_entrypoint_mailrelay_${ENTRYPOINT_MAILRELAY_CONF_VERSION}
file: entrypoint.mailrelay.sh.tmpl
template_driver: golang
secrets:
smtp_password:
name: ${STACK_NAME}_smtp_password_${SECRET_SMTP_PASSWORD_VERSION}
external: true

View File

@ -1,3 +1,14 @@
account default
host {{ env "SMTP_HOST" }}
from {{ env "MAIL_FROM" }}
port {{ env "SMTP_PORT" }}
{{ if eq (env "SMTP_AUTH") "on" }}
auth {{ env "SMTP_AUTH" }}
passwordeval "cat /run/secrets/smtp_password"
{{ end }}
{{ if eq (env "SMTP_TLS") "on" }}
tls {{ env "SMTP_TLS" }}
tls_trust_file /etc/ssl/certs/ca-certificates.crt
{{ end }}