From 03eeee8dd7c92ba3b831f7154da18b80d58540fe Mon Sep 17 00:00:00 2001 From: outlook84 <96007761+outlook84@users.noreply.github.com> Date: Sun, 13 Jul 2025 02:12:56 +0000 Subject: [PATCH] Create a symlink to config file for compatibility with the healthcheck script --- docker/alpine/healthcheck.sh | 4 ++-- docker/alpine/init.sh | 31 ++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/docker/alpine/healthcheck.sh b/docker/alpine/healthcheck.sh index b1265571..70e71bf6 100644 --- a/docker/alpine/healthcheck.sh +++ b/docker/alpine/healthcheck.sh @@ -2,8 +2,8 @@ set -e -PORT=${FB_PORT:-$(cat /config/settings.json | sh /JSON.sh | grep '\["port"\]' | awk '{print $2}')} -ADDRESS=${FB_ADDRESS:-$(cat /config/settings.json | sh /JSON.sh | grep '\["address"\]' | awk '{print $2}' | sed 's/"//g')} +PORT=${FB_PORT:-$(cat /tmp/FB_CONFIG | sh /JSON.sh | grep '\["port"\]' | awk '{print $2}')} +ADDRESS=${FB_ADDRESS:-$(cat /tmp/FB_CONFIG | sh /JSON.sh | grep '\["address"\]' | awk '{print $2}' | sed 's/"//g')} ADDRESS=${ADDRESS:-localhost} wget -q --spider http://$ADDRESS:$PORT/health || exit 1 \ No newline at end of file diff --git a/docker/alpine/init.sh b/docker/alpine/init.sh index ccd04cd4..5ea2cf6e 100755 --- a/docker/alpine/init.sh +++ b/docker/alpine/init.sh @@ -7,19 +7,32 @@ if [ ! -f "/config/settings.json" ]; then cp -a /defaults/settings.json /config/settings.json fi -# Deal with the case where user does not provide a config argument -has_config_arg=0 +# Extract config file path from arguments +config_file="" +next_is_config=0 for arg in "$@"; do - case "$arg" in - --config|--config=*|-c|-c=*) - has_config_arg=1 + if [ "$next_is_config" -eq 1 ]; then + config_file="$arg" break - ;; + fi + case "$arg" in + -c|--config) + next_is_config=1 + ;; + -c=*|--config=*) + config_file="${arg#*=}" + break + ;; esac done -if [ "$has_config_arg" -eq 0 ]; then - set -- --config=/config/settings.json "$@" -fi +# If no config argument is provided, set the default and add it to the args +if [ -z "$config_file" ]; then + config_file="/config/settings.json" + set -- --config=/config/settings.json "$@" +fi + +# Create a symlink to the config file for compatibility with the healthcheck script +ln -s "$config_file" /tmp/FB_CONFIG exec filebrowser "$@" \ No newline at end of file