filebrowser/docker/alpine/init.sh
outlook84 0d5be86a40 feat: Improve Docker entrypoint and config handling
- Simplify Dockerfile ENTRYPOINT to delegate config handling to init.sh.
- Enhance init.sh to automatically add `--config=/config/settings.json` if no config argument is provided.
2025-07-12 12:00:15 +08:00

25 lines
442 B
Bash
Executable File

#!/bin/sh
set -e
# Ensure configuration exists
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
for arg in "$@"; do
case "$arg" in
--config=*)
has_config_arg=1
break
;;
esac
done
if [ "$has_config_arg" -eq 0 ]; then
set -- --config=/config/settings.json "$@"
fi
exec filebrowser "$@"