diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index c362eac3a3..2019b2e679 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -18,6 +18,19 @@ if [ "${PUID}" != "0" ] || [ "${PGID}" != "0" ]; then echo "Changing owner to $PUID:$PGID, done." fi +# support __FILE Suffix for environment variables +for file_var in $(env | grep '__FILE='); do + target_var=$(echo "$file_var" | cut -d'=' -f1 | sed 's/__FILE//') + file_path=$(echo "$file_var" | cut -d'=' -f2) + + if [ -f "$file_path" ]; then + export "$target_var"=$(cat "$file_path" | tr -d '\n\r') + echo "Info: Loaded secret for $target_var from $file_path" + else + echo "Warning: Secret file $file_path not found for $target_var" + fi +done + if [ "${PUID}" != "0" ]; then exec su-exec $PUID:$PGID "$@" else