foodsoft/docker-entrypoint.sh
Patrick Gansterer a0d4fad4d8 Add multi_coop configuration via environment variable in docker setup
If the file app_config.defaults.yml exists in the working directory,
the content will be written to the config/app_config.yml and appended
by a configuration entry for every foodcoop in the space separated
environment variable FOODSOFT_FOODCOOPS.
2019-10-28 19:01:02 +01:00

22 lines
435 B
Bash
Executable file

#!/bin/sh
set -e
# allow re-using the instance - https://stackoverflow.com/a/38732187/2866660
if [ -f tmp/pids/server.pid ]; then
rm tmp/pids/server.pid
fi
if [ -e app_config.defaults.yml ] ; then
cat app_config.defaults.yml > config/app_config.yml
for FOODCOOP in $FOODSOFT_FOODCOOPS; do
cat << EOF >> config/app_config.yml
$FOODCOOP:
<<: *defaults
database:
database: foodsoft_$FOODCOOP
EOF
done
fi
exec "$@"