Skip to content

Commit

Permalink
Fix saved config
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-arthur committed Sep 8, 2024
1 parent 88f5457 commit e98444c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ENV COMPOSER_ALLOW_SUPERUSER=1 \
OJS_VERSION=stable-3_4_0 \
OJS_CLI_INSTALL="1" \
OJS_WEB_CONF="/etc/apache2/conf.d/ojs.conf" \
OJS_CONF="/var/www/html/config.inc.php"
OJS_CONF="/var/www/html/config.inc.php" \
SAVED_OJS_CONF="/home/config.inc.php"

# PHP_INI_DIR to be symmetrical with official php docker image
ENV PHP_INI_DIR /etc/php/8.1
Expand Down Expand Up @@ -108,10 +109,7 @@ RUN set -xe \
&& NODE_OPTIONS=--openssl-legacy-provider npm run build \
# Create directories
&& mkdir -p /var/www/files /run/apache2 \
&& if test -f /home/config.inc.php; then \
cp /home/config.inc.php config.inc.php; \
else cp config.TEMPLATE.inc.php config.inc.php; \
fi\
&& cp config.TEMPLATE.inc.php config.inc.php \
&& chown -R apache:apache /var/www/* \
# Prepare freefont for captcha
&& ln -s /usr/share/fonts/TTF/FreeSerif.ttf /usr/share/fonts/FreeSerif.ttf \
Expand Down
23 changes: 13 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ chown apache /home/files
chgrp apache /home/files

declare -A configVariable
if ! test -f /home/config.inc.php; then
if [ -f $SAVED_OJS_CONF ]
then
echo "Using existing config.inc.php from /home/config.inc.php"
cp $SAVED_OJS_CONF $OJS_CONF
else
# Set config variables using env variables https://github.com/pkp/ojs/blob/main/config.TEMPLATE.inc.php
echo "Updating OJS config based on env variables..."
echo "No existing config in /home. Updating OJS config based on env variables..."
# General
configVariable["installed"]="On"
configVariable["base_url"]=$WEBSITE_HOSTNAME
# configVariable["base_url"]=$WEBSITE_HOSTNAME
configVariable["base_url"]="https://submissions.post45.org"
configVariable["time_zone"]=$TIME_ZONE
configVariable["restful_urls"]="On"
# Database
Expand All @@ -49,13 +54,11 @@ if ! test -f /home/config.inc.php; then
configVariable["default_envelope_sender"]="[email protected]"
# OAI
configVariable["oai"]="Off"
for key in "${!configVariable[@]}"; do
ojs-variable $key ${configVariable[$key]}
done
cp $OJS_CONF $SAVED_OJS_CONF
fi

for key in "${!configVariable[@]}"; do
ojs-variable $key ${configVariable[$key]}
done

chmod +x /usr/local/bin/ojs-start
ojs-start
# Note: Fresh installs are async, so /home/config.inc.php may not be correct
cp config.inc.php /home/config.inc.php
ojs-start

0 comments on commit e98444c

Please sign in to comment.