Detach environment variables from docker-compose.yml

This commit is contained in:
Livvy Mackintosh
2017-05-21 01:52:01 +02:00
parent f1d8f00af0
commit 5d761fdbc4
4 changed files with 160 additions and 75 deletions

View File

@ -6,7 +6,8 @@
# Olivia Mackintosh <livvy@base.nu>
THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TEMPLATE=${THISDIR}/../docker-compose.yml.template
TEMPLATE=${THISDIR}/../environment.template
TARGET=${THISDIR}/../environment
if [ -z "$DATABASE_PASSWORD" ]; then
echo "Error: Please set \$DATABASE_PASSWORD"
@ -18,4 +19,13 @@ if [ -z "$SMTP_PASSWORD" ]; then
exit 1
fi
envsubst < $TEMPLATE | cat -
if [ -z "$SECRET_KEY" ]; then
echo "Error: Please set \$SECRET_KEY"
exit 1
fi
# Make sure only root can access and then
# sub in the environment variables.
sudo chown root:root $TARGET
sudo chmod 660 $TARGET
envsubst < $TEMPLATE | sudo tee $TARGET