Skip to content

Commit

Permalink
emailer using mandrill
Browse files Browse the repository at this point in the history
  • Loading branch information
tpizah committed Aug 17, 2015
1 parent 542f2dd commit bafea46
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions emailer/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ WORKDIR=/srv/emailer

# check environment variables
[ -z "${DB_PORT_5432_TCP_ADDR}" ] && echo "The Postgres container is not correctly linked! Add --link postgres:db to the docker run parameters!" && exit 1
[ -z "${POSTGRES_PASSWORD}" ] && echo "Postgres password undefined! Add -e POSTGRES_PASSWORD=\"blabla\" to the docker run parameters!" && exit 1
[ -z "${MAIL_ADDR}" ] && echo "Undefined mailing host! Add -e MAIL_ADDR=\"IP\" to the docker run parameters!" && exit 1
[ -z "${DB_ENV_POSTGRES_PASSWORD}" ] && echo "Undefined postgres password! Add --link postgres:db to the docker run parameters!" && exit 1
[ -z "${MANDRILL_API_KEY}" ] && echo "Undefined Mandrill API KEY! Add -e MANDRILL_API_KEY=\"apikey\" to the docker run parameters!" && exit 1
[ -z "${DOMAIN}" ] && echo "Domain undefined! Add -e DOMAIN=\"ip or domain name\" to the docker run parameters!" && exit 1

cp $WORKDIR/config.ini.example $WORKDIR/config.ini
sed -i "s/provider = smtp/provider = mandrill/" $WORKDIR/config.ini
sed -i "/\[database\]/{n;s/.*/hostname = ${DB_PORT_5432_TCP_ADDR}/}" $WORKDIR/config.ini
sed -i "s/username = mitro/username = postgres/" $WORKDIR/config.ini
sed -i "s/password = mitro/password = ${POSTGRES_PASSWORD}/" $WORKDIR/config.ini
sed -i "/\[smtp\]/{n;s/.*/hostname = ${MAIL_ADDR}/}" $WORKDIR/config.ini
sed -i "s/tls=true/tls=false/" $WORKDIR/config.ini
sed -i "s/password = mitro/password = ${DB_ENV_POSTGRES_PASSWORD}/" $WORKDIR/config.ini
sed -i "s/[email protected]/[email protected]/" $WORKDIR/config.ini
sed -i "s/[email protected]/[email protected]/" $WORKDIR/config.ini
sed -i "s/mitro.co/${DOMAIN}/" $WORKDIR/config.ini
sed -i "/\[mandrill\]/{n;s/.*/api_key = ${MANDRILL_API_KEY}/}" $WORKDIR/config.ini

sed -i "s/logging.INFO/logging.DEBUG/" $WORKDIR/emailer.py

exec "$@"

0 comments on commit bafea46

Please sign in to comment.