-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·29 lines (23 loc) · 954 Bytes
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
conf=/etc/ssmtp/ssmtp.conf
custom_conf=/etc/ssmtp/ssmtp_custom.conf
revaliases=/etc/ssmtp/revaliases
custom_revaliases=/etc/ssmtp/revaliases_custom
USE_TLS=${TLS:-'NO'}
USE_STARTTLS=${TLS:-'NO'}
[ ! $HOST ] && echo 'HOST is not set. eg: smtp.gmail.com' && exit 1
[ ! $PORT ] && echo 'PORT is not set. eg: 465' && exit 1
[ ! $AUTH_USER ] && echo 'AUTH_USER is not set. eg: [email protected]' && exit 1
[ ! $AUTH_PASS ] && echo 'AUTH_PASS is not set. eg: xyz' && exit 1
sed -i "s|{{ mailhub }}|$HOST:$PORT|g" $custom_conf
sed -i "s|{{ AuthUser }}|$AUTH_USER|g" $custom_conf
sed -i "s|{{ AuthPass }}|$AUTH_PASS|g" $custom_conf
sed -i "s|{{ UseTLS }}|$USE_TLS|g" $custom_conf
sed -i "s|{{ UseSTARTTLS }}|$USE_STARTTLS|g" $custom_conf
rm -f $conf
mv $custom_conf $conf
sed -i "s|{{ mailhub }}|$HOST:$PORT|g" $custom_revaliases
sed -i "s|{{ AuthUser }}|$AUTH_USER|g" $custom_revaliases
rm -f $revaliases
mv $custom_revaliases $revaliases
exec "$@"