summaryrefslogtreecommitdiffstats
path: root/docker/filebin_starter.sh
diff options
context:
space:
mode:
authorSebastian Rakel <sebastian@devunit.eu>2018-08-29 10:00:54 +0200
committerSebastian Rakel <sebastian@devunit.eu>2018-08-29 13:04:34 +0200
commitece8a5d7e499f99c2171edbcf5e4dde455541912 (patch)
tree8c676dbf5d6fc029a068f2a6b7124e53b80dea55 /docker/filebin_starter.sh
parenteba4933c6d529ec76048d21af8218be90fd6505b (diff)
Use msmtp to send mail in docker container
To send mails in the docker container we need to configure php to use a smtp client and provide smtp credentials to the docker container
Diffstat (limited to 'docker/filebin_starter.sh')
-rwxr-xr-xdocker/filebin_starter.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/docker/filebin_starter.sh b/docker/filebin_starter.sh
index 7f0b70d85..66f9a8b03 100755
--- a/docker/filebin_starter.sh
+++ b/docker/filebin_starter.sh
@@ -2,12 +2,29 @@
#set -euo pipefail
+function set_mail_config() {
+cat <<EOF > ${FILEBIN_HOME_DIR}/msmtprc
+account filebinmail
+tls on
+tls_certcheck off
+auth on
+host ${FB_SMTP_HOST}
+port ${FB_SMTP_PORT}
+user ${FB_SMTP_USER}
+from ${FB_SMTP_USER}
+password ${FB_SMTP_PASSWORD}
+EOF
+
+chmod 600 ${FILEBIN_HOME_DIR}/msmtprc
+}
+
function set_config() {
FB_ENCRYPTION_KEY=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32`
cat <<EOF >${FILEBIN_DIR}/application/config/config-local.php
<?php
\$config['base_url'] = 'http://127.0.0.1:8080/';
\$config['encryption_key'] = '${FB_ENCRYPTION_KEY}';
+\$config['email_from'] = '${FB_SMTP_USER}';
EOF
}
@@ -53,6 +70,7 @@ if [[ ! -e $FILEBIN_DIR/application/config/config-local.php ]]; then
set_config
set_database_config
+ set_mail_config
CONTACT_INFO_FILE=${FILEBIN_DIR}/data/local/contact-info.php
cp $FILEBIN_DIR/data/local/examples/contact-info.php ${CONTACT_INFO_FILE}