-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 "$@" |