2017-02-11 12:44:49 +01:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2017-10-01 13:57:36 +02:00
|
|
|
# allow re-using the instance - https://stackoverflow.com/a/38732187/2866660
|
2017-02-11 12:44:49 +01:00
|
|
|
if [ -f tmp/pids/server.pid ]; then
|
|
|
|
rm tmp/pids/server.pid
|
|
|
|
fi
|
|
|
|
|
2022-05-27 18:35:00 +02:00
|
|
|
if [ ! -z "${FOODSOFT_DB_PREFIX}" ] || [ ! -z "${FOODSOFT_DB_PREFIX_FILE}" ]; then
|
|
|
|
FOODSOFT_FOODCOOPS=`BUNDLE_CONFIG=/dev/null bundle exec ruby script/list_databases`
|
|
|
|
fi
|
|
|
|
|
2018-12-18 15:30:55 +01:00
|
|
|
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
|
|
|
|
|
2017-02-11 12:44:49 +01:00
|
|
|
exec "$@"
|