drop need to write config file to /srv/ledgersmb

Instead write it to /tmp.
Also don't copy the entire example file, just write the bits we need
This commit is contained in:
sbts 2017-07-02 00:52:36 +08:00
parent 2d4bb886f8
commit d0384889a8
2 changed files with 15 additions and 11 deletions

View File

@ -81,8 +81,5 @@ RUN mkdir -p /tmp && \
# Internal Port Expose # Internal Port Expose
EXPOSE 5762 EXPOSE 5762
# If ledgersmb.conf does not exist, www-data user needs to be able to create it.
RUN chown www-data /srv/ledgersmb
USER www-data
CMD ["start.sh"] CMD ["start.sh"]

View File

@ -4,14 +4,20 @@ update_ssmtp.sh
cd /srv/ledgersmb cd /srv/ledgersmb
if [[ ! -f ledgersmb.conf ]]; then if [[ ! -f ledgersmb.conf ]]; then
cp conf/ledgersmb.conf.default ledgersmb.conf cat <<EOF >/tmp/ledgersmb.conf
sed -i \ [main]
-e "s/\(cache_templates = \).*\$/cache_templates = 1/g" \ cache_templates = 1
-e "s/\(host = \).*\$/\1$POSTGRES_HOST/g" \
-e "s/\(port = \).*\$/\1$POSTGRES_PORT/g" \ [database]
-e "s/\(default_db = \).*\$/\1$DEFAULT_DB/g" \ host = $POSTGRES_HOST
-e "s%\(sendmail = \).*%\1/usr/sbin/ssmtp%g" \ port = $POSTGRES_PORT
/srv/ledgersmb/ledgersmb.conf default_db = $DEFAULT_DB
[mail]
sendmail = /usr/sbin/ssmtp
EOF
export LSMB_CONFIG_FILE='/tmp/ledgersmb.conf'
fi fi
if [ ! -f "/tmp/ledgersmb" ]; then if [ ! -f "/tmp/ledgersmb" ]; then
@ -26,6 +32,7 @@ fi
# Needed for modules loaded by cpanm # Needed for modules loaded by cpanm
export PERL5LIB export PERL5LIB
for PerlLib in /usr/lib/perl5* /usr/local/lib/perl5*/site_perl/* ; do for PerlLib in /usr/lib/perl5* /usr/local/lib/perl5*/site_perl/* ; do
[[ -d "$PerlLib" ]] && { [[ -d "$PerlLib" ]] && {
PERL5LIB="$PerlLib"; PERL5LIB="$PerlLib";