diff --git a/Dockerfile b/Dockerfile index 6f05506..0fad611 100644 --- a/Dockerfile +++ b/Dockerfile @@ -108,7 +108,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\ + && if test -f /home/config.inc.php; then cp /home/config.inc.php config.inc.php; echo "Using stored config in /home/config.inc.php"; else cp config.TEMPLATE.inc.php config.inc.php; echo "Copying config from tepmlate"; fi \ && chown -R apache:apache /var/www/* \ # Prepare freefont for captcha && ln -s /usr/share/fonts/TTF/FreeSerif.ttf /usr/share/fonts/FreeSerif.ttf \ diff --git a/entrypoint.sh b/entrypoint.sh index d422ccd..6ca6a35 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,24 +7,27 @@ eval $(printenv | sed -n "s/^\([^=]\+\)=\(.*\)$/export \1=\2/p" | sed 's/"/\\\"/ echo "Starting SSH ..." /usr/sbin/sshd -chmod +x /usr/local/bin/ojs-variable -# Temporary fix for error in ojs-variable (fixed here https://gitlab.com/pkp-org/docker/ojs/-/commit/f4f33f370e7c765b599868f0ca701898c875b47f, but not in stable-3_4_0 branch) -sed -i 's:/tmp/ojs.config.inc.php:/tmp/config.inc.php:' /usr/local/bin/ojs-variable +# Only set config variables if this is a fresh install (Note: these vars might be incomplete) +if ! test -f /home/config.inc.php; then + chmod +x /usr/local/bin/ojs-variable + # Temporary fix for error in ojs-variable (fixed here https://gitlab.com/pkp-org/docker/ojs/-/commit/f4f33f370e7c765b599868f0ca701898c875b47f, but not in stable-3_4_0 branch) + sed -i 's:/tmp/ojs.config.inc.php:/tmp/config.inc.php:' /usr/local/bin/ojs-variable -# 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..." -declare -A configVariable -configVariable["base_url"]=$WEBSITE_HOSTNAME -configVariable["restful_urls"]="On" -configVariable["host"]=$OJS_DB_HOST -configVariable["username"]=$OJS_DB_USER -configVariable["password"]=$OJS_DB_PASSWORD -configVariable["name"]=$OJS_DB_NAME -configVariable["time_zone"]=$TIME_ZONE + # 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..." + declare -A configVariable + configVariable["base_url"]=$WEBSITE_HOSTNAME + configVariable["restful_urls"]="On" + configVariable["host"]=$OJS_DB_HOST + configVariable["username"]=$OJS_DB_USER + configVariable["password"]=$OJS_DB_PASSWORD + configVariable["name"]=$OJS_DB_NAME + configVariable["time_zone"]=$TIME_ZONE -for key in "${!configVariable[@]}"; do - ojs-variable $key ${configVariable[$key]} -done + for key in "${!configVariable[@]}"; do + ojs-variable $key ${configVariable[$key]} + done +fi; chmod +x /usr/local/bin/ojs-start ojs-start \ No newline at end of file