From 99fb3a8c96771af1b405ed90be6b423329c53d2f Mon Sep 17 00:00:00 2001 From: Marko Dzidic Date: Tue, 15 Aug 2017 15:27:57 +0200 Subject: [PATCH] Add support for environment variables Expanded docker-start.sh with support for environment variables. - STAYTUS_THEME - STAYTUS_DEMO - STAYTUS_SMTP_ENABLED - STAYTUS_SMTP_HOSTNAME - STAYTUS_SMTP_USERNAME - STAYTUS_SMTP_PASSWORD --- docker-start.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docker-start.sh b/docker-start.sh index 6e2d136b..51770d0f 100755 --- a/docker-start.sh +++ b/docker-start.sh @@ -2,6 +2,26 @@ /etc/init.d/mysql start cd /opt/staytus +# Enable SMTP via environment variable +STAYTUS_SMTP_ENABLED=${STAYTUS_SMTP_ENABLED:-false} + +# Set environment variables +if [ "$STAYTUS_SMTP_ENABLED" = true ]; then +cat << EOF > /opt/staytus/config/environment.yml +STAYTUS_THEME: '${STAYTUS_THEME:-default}' +STAYTUS_DEMO: '${STAYTUS_DEMO:-0}' + +STAYTUS_SMTP_HOSTNAME: ${STAYTUS_SMTP_HOSTNAME:-smtp.deliverhq.com} +STAYTUS_SMTP_USERNAME: ${STAYTUS_SMTP_USERNAME:-username} +STAYTUS_SMTP_PASSWORD: ${STAYTUS_SMTP_PASSWORD:-password} +EOF +else +cat << EOF > /opt/staytus/config/environment.yml +STAYTUS_THEME: '${STAYTUS_THEME:-default}' +STAYTUS_DEMO: '${STAYTUS_DEMO:-0}' +EOF +fi + # Configure DB with random password, if not already configured if [ ! -f /opt/staytus/persisted/config/database.yml ]; then export RANDOM_PASSWORD=`openssl rand -base64 32`