feat: make smtp settings configurable in .env
This commit is contained in:
parent
0e8c5ecd17
commit
f0bbb28626
11
.env.sample
11
.env.sample
|
@ -19,6 +19,17 @@ SECRET_BBB_SECRET_VERSION=v1
|
||||||
|
|
||||||
EXTRA_VOLUME=/dev/null:/tmp/.dummy
|
EXTRA_VOLUME=/dev/null:/tmp/.dummy
|
||||||
|
|
||||||
|
# COMPOSE_FILE="$COMPOSE_FILE:compose.smtp.yml"
|
||||||
|
# See https://github.com/nextcloud/docker#auto-configuration-via-environment-variables for default values
|
||||||
|
# SMTP_AUTHTYPE=
|
||||||
|
# SMTP_HOST=
|
||||||
|
# SMTP_SECURE=
|
||||||
|
# SMTP_NAME=
|
||||||
|
# SMTP_PORT=
|
||||||
|
# MAIL_FROM_ADDRESS=
|
||||||
|
# MAIL_DOMAIN=
|
||||||
|
# SECRET_SMTP_PASSWORD_VERSION=v1
|
||||||
|
|
||||||
# X_FRAME_OPTIONS_ENABLED=1
|
# X_FRAME_OPTIONS_ENABLED=1
|
||||||
# X_FRAME_OPTIONS_ALLOW_FROM=embedding-site.example.org
|
# X_FRAME_OPTIONS_ALLOW_FROM=embedding-site.example.org
|
||||||
# APPS="calendar sociallogin onlyoffice"
|
# APPS="calendar sociallogin onlyoffice"
|
||||||
|
|
2
abra.sh
2
abra.sh
|
@ -3,7 +3,7 @@
|
||||||
export FPM_TUNE_VERSION=v4
|
export FPM_TUNE_VERSION=v4
|
||||||
export NGINX_CONF_VERSION=v4
|
export NGINX_CONF_VERSION=v4
|
||||||
export MY_CNF_VERSION=v4
|
export MY_CNF_VERSION=v4
|
||||||
export ENTRYPOINT_VERSION=v2
|
export ENTRYPOINT_VERSION=v3
|
||||||
|
|
||||||
run_occ(){
|
run_occ(){
|
||||||
su -p www-data -s /bin/sh -c "/var/www/html/occ $@"
|
su -p www-data -s /bin/sh -c "/var/www/html/occ $@"
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
secrets:
|
||||||
|
- smtp_password
|
||||||
|
environment:
|
||||||
|
- SMTP_AUTHTYPE
|
||||||
|
- SMTP_HOST
|
||||||
|
- SMTP_SECURE
|
||||||
|
- SMTP_NAME
|
||||||
|
- SMTP_PORT
|
||||||
|
- SMTP_PASSWORD_FILE=/run/secrets/smtp_password
|
||||||
|
- MAIL_FROM_ADDRESS
|
||||||
|
- MAIL_DOMAIN
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
smtp_password:
|
||||||
|
external: true
|
||||||
|
name: ${STACK_NAME}_smtp_password_${SECRET_SMTP_PASSWORD_VERSION}
|
|
@ -61,10 +61,6 @@ services:
|
||||||
- NEXTCLOUD_TRUSTED_DOMAINS=${DOMAIN}
|
- NEXTCLOUD_TRUSTED_DOMAINS=${DOMAIN}
|
||||||
- TRUSTED_PROXIES=traefik
|
- TRUSTED_PROXIES=traefik
|
||||||
- REDIS_HOST=cache
|
- REDIS_HOST=cache
|
||||||
- SMTP_HOST
|
|
||||||
- MAIL_FROM_ADDRESS
|
|
||||||
- MAIL_DOMAIN
|
|
||||||
- SMTP_AUTHTYPE=PLAIN
|
|
||||||
- OVERWRITEPROTOCOL=https
|
- OVERWRITEPROTOCOL=https
|
||||||
- PHP_MEMORY_LIMIT=1G
|
- PHP_MEMORY_LIMIT=1G
|
||||||
- ONLYOFFICE_URL
|
- ONLYOFFICE_URL
|
||||||
|
|
|
@ -1,5 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
file_env() {
|
||||||
|
local var="$1"
|
||||||
|
local fileVar="${var}_FILE"
|
||||||
|
local def="${2:-}"
|
||||||
|
|
||||||
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||||
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local val="$def"
|
||||||
|
if [ "${!var:-}" ]; then
|
||||||
|
val="${!var}"
|
||||||
|
elif [ "${!fileVar:-}" ]; then
|
||||||
|
val="$(< "${!fileVar}")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export "$var"="$val"
|
||||||
|
unset "$fileVar"
|
||||||
|
}
|
||||||
|
|
||||||
|
file_env "SMTP_PASSWORD"
|
||||||
|
|
||||||
echo "Giving the db container some time to come up"; sleep 20
|
echo "Giving the db container some time to come up"; sleep 20
|
||||||
# see this issue with postgres db https://github.com/nextcloud/docker/issues/1204
|
# see this issue with postgres db https://github.com/nextcloud/docker/issues/1204
|
||||||
|
|
||||||
|
@ -9,4 +34,6 @@ if ! [[ $(grep {{ env "X_FRAME_OPTIONS_ALLOW_FROM" }} lib/public/AppFramework/Ht
|
||||||
fi
|
fi
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/entrypoint.sh php-fpm
|
/entrypoint.sh php-fpm
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
Add SMTP Config to your .env file:
|
||||||
|
|
||||||
|
```
|
||||||
|
# COMPOSE_FILE="$COMPOSE_FILE:compose.smtp.yml"
|
||||||
|
# See https://github.com/nextcloud/docker#auto-configuration-via-environment-variables for default values
|
||||||
|
# SMTP_AUTHTYPE=
|
||||||
|
# SMTP_HOST=
|
||||||
|
# SMTP_SECURE=
|
||||||
|
# SMTP_NAME=
|
||||||
|
# SMTP_PORT=
|
||||||
|
# MAIL_FROM_ADDRESS=
|
||||||
|
# MAIL_DOMAIN=
|
||||||
|
# SECRET_SMTP_PASSWORD_VERSION=v1
|
||||||
|
```
|
Loading…
Reference in New Issue