Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for environment variables #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docker-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down