diff --git a/README.md b/README.md index dca5853..c1ae96b 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,22 @@ You can also forward all emails received by testi@testo.com to multiple destinat export SMF_CONFIG='testi@testo.com:test1@test.com|test2@test.com|test3@test.com' ``` +### `SMF_CONFIG_FILE` Examples + +If you want to have a config file instead of a config variable +You can add it like: +```bash +cat forwards +testi@testo.com:test1@test.com|test2@test.com|test3@test.com +from@testi.com:to@testo.com:ThisIsPassword +EOF +``` + +And then run it: +```bash +docker run -e SMF_CONFIG_FILE=/forwards -v $(pwd)/forwards:/forwards -p 25:25 zixia/simple-mail-forwarder +``` + ### `SMF_RELAYHOST` Examples Here's how to configure a relayhost/smarthost to use for forwarding mail. @@ -190,6 +206,8 @@ If the `SMF_RELAYHOST` require authentication, export SMF_RELAYAUTH='username@relayhost.com:RelayHostPassword' ``` + + TLS (SSL) Certificates -------------------- diff --git a/entrypoint.sh b/entrypoint.sh index 7a7c5f8..00e27f1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,6 +17,7 @@ $ docker run -p 25:25 \\ Environment Variables: SMF_DOMAIN - mail server hostname. use tutum/docker hostname if omitted. SMF_CONFIG - mail forward addresses mapping list. + SMF_CONFIG_FILE - file name that contain forward adresses mapping list. SMF_MYNETWORKS - configure relaying from trusted IPs, see http://www.postfix.org/postconf.5.html#mynetworks SMF_RELAYHOST - configure a relayhost SMF_SENDERPRIVACY - strips sender's IP, client, and user agent. @@ -349,6 +350,17 @@ else echo ">> END SMF_DOMAIN found. value:[$SMF_DOMAIN]" fi +if [ "" == "$SMF_CONFIG_FILE" ]; then + echo ">> ENV SMF_CONFIG_FILE not set." +elif [ ! -f "$SMF_CONFIG_FILE" ]; then + echo ">> $SMF_CONFIG_FILE doesn't exists, skipping reading it." +else + echo ">> END SMF_CONFIG_FILE found. value:[$SMF_CONFIG_FILE]" + echo ">> INSERT config file into config var" + SMF_CONFIG=$(cat /$SMF_CONFIG_FILE | tr '\n' ';') + export SMF_CONFIG +fi + if [ "" == "$SMF_CONFIG" ] then echo ">> END SMF_CONFIG not set."