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.
This commit is contained in:
parent
ae11931ca5
commit
a0d4fad4d8
2 changed files with 16 additions and 2 deletions
|
@ -39,14 +39,15 @@ RUN export DATABASE_URL=mysql2://localhost/temp?encoding=utf8 && \
|
|||
cp config/app_config.yml.SAMPLE config/app_config.yml && \
|
||||
cp config/database.yml.MySQL_SAMPLE config/database.yml && \
|
||||
bundle exec rake db:setup assets:precompile && \
|
||||
rm -Rf config/app_config.yml tmp/* && \
|
||||
rm -Rf tmp/* && \
|
||||
/etc/init.d/mysql stop && \
|
||||
rm -Rf /run/mysqld /tmp/* /var/tmp/* /var/lib/mysql /var/log/mysql* && \
|
||||
apt-get purge -y --auto-remove mariadb-server && \
|
||||
rm -Rf /var/lib/apt/lists/* /var/cache/apt/*
|
||||
|
||||
# Make relevant dirs writable for app user
|
||||
# Make relevant dirs and files writable for app user
|
||||
RUN mkdir -p tmp && \
|
||||
chown nobody config/app_config.yml && \
|
||||
chown nobody tmp
|
||||
|
||||
# Run app as unprivileged user
|
||||
|
|
|
@ -6,4 +6,17 @@ 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 "$@"
|
||||
|
|
Loading…
Reference in a new issue