mirror of
https://github.com/ledgersmb/ledgersmb-docker.git
synced 2025-10-18 10:10:35 -04:00
Use the container gateway address as the SMTP host
The value 172.17.0.1 is the default gateway on the default Docker network. However, when using this image with 'docker-compose', a new network is created, which means that the IP address of the gateway is different by definition. Because the network is created at the same time as the containers, the IP address isn't available when the YAML definition is created. This approach replaces the static approach with a dynamic approach executed at first container startup.
This commit is contained in:
7
start.sh
7
start.sh
@@ -67,7 +67,6 @@ if [[ -n "$LSMB_HAVE_DEPRECATED" ]]; then
|
||||
echo "!!! DEPRECATED \$SSMTP_* PARAMETERS WILL BE REMOVED in the 1.9 image!!!"
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! -f ./local/conf/ledgersmb.yaml ]]; then
|
||||
cat <<EOF >./local/conf/ledgersmb.yaml
|
||||
paths:
|
||||
@@ -105,6 +104,12 @@ EOF
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPHOST" ]]
|
||||
then
|
||||
if [[ "$LSMB_MAIL_SMTPHOST" == "__CONTAINER_GATEWAY__" ]]
|
||||
then
|
||||
LSMB_MAIL_SMTPHOST="$(ip route | awk '/default/ { print $3 }')"
|
||||
export LSMB_MAIL_SMTPHOST
|
||||
fi
|
||||
|
||||
cat <<EOF >./local/conf/ledgersmb.000.yaml
|
||||
mail:
|
||||
transport:
|
||||
|
Reference in New Issue
Block a user