From 9893ad41dc6924f132b6c48b842d2212d7a78c85 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 12:33:50 +0000 Subject: [PATCH] Fix cron auto-import env vars and health check log spam for Firefly III Data Importer - Source /etc/environment in cronupdate to load addon env vars (FIREFLY_III_URL, etc.) - Persist cron-needed vars (JSON_CONFIGURATION_DIR, IMPORT_DIR_WHITELIST, etc.) to /etc/environment - Fix inverted nginx map values that caused health check logs to spam while suppressing real requests Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- fireflyiii_data_importer/Dockerfile | 2 +- .../rootfs/etc/cont-init.d/99-run.sh | 11 +++++++++++ fireflyiii_data_importer/rootfs/templates/cronupdate | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fireflyiii_data_importer/Dockerfile b/fireflyiii_data_importer/Dockerfile index 6a82d6ebc..764437b5d 100644 --- a/fireflyiii_data_importer/Dockerfile +++ b/fireflyiii_data_importer/Dockerfile @@ -168,7 +168,7 @@ RUN \ \ # Handle Nginx configuration if [ -f /etc/nginx/nginx.conf ]; then \ - awk '/http \{/{print; print "map $http_user_agent $dontlog {\n default 0;\n \"~*HealthCheck\" 1;\n}\naccess_log /var/log/nginx/access.log combined if=$dontlog;"; next}1' /etc/nginx/nginx.conf > /etc/nginx/nginx.conf.new && \ + awk '/http \{/{print; print "map $http_user_agent $loggable {\n default 1;\n \"~*HealthCheck\" 0;\n}\naccess_log /var/log/nginx/access.log combined if=$loggable;"; next}1' /etc/nginx/nginx.conf > /etc/nginx/nginx.conf.new && \ mv /etc/nginx/nginx.conf.new /etc/nginx/nginx.conf; \ fi diff --git a/fireflyiii_data_importer/rootfs/etc/cont-init.d/99-run.sh b/fireflyiii_data_importer/rootfs/etc/cont-init.d/99-run.sh index 1448cc1dc..7e5e1cbca 100755 --- a/fireflyiii_data_importer/rootfs/etc/cont-init.d/99-run.sh +++ b/fireflyiii_data_importer/rootfs/etc/cont-init.d/99-run.sh @@ -25,6 +25,17 @@ export CAN_POST_FILES="$(bashio::config "CAN_POST_FILES")" # shellcheck disable=SC2155 export CAN_POST_AUTOIMPORT="$(bashio::config "CAN_POST_AUTOIMPORT")" +# Persist variables to /etc/environment for cron jobs +{ + [ -n "$JSON_CONFIGURATION_DIR" ] && echo "JSON_CONFIGURATION_DIR=\"$JSON_CONFIGURATION_DIR\"" + echo "IMPORT_DIR_ALLOWLIST=\"$IMPORT_DIR_ALLOWLIST\"" + echo "IMPORT_DIR_WHITELIST=\"$IMPORT_DIR_WHITELIST\"" + echo "AUTO_IMPORT_SECRET=\"$AUTO_IMPORT_SECRET\"" + echo "CAN_POST_FILES=\"$CAN_POST_FILES\"" + echo "CAN_POST_AUTOIMPORT=\"$CAN_POST_AUTOIMPORT\"" +} >> /etc/environment +chmod 600 /etc/environment + ################ # CRON OPTIONS # ################ diff --git a/fireflyiii_data_importer/rootfs/templates/cronupdate b/fireflyiii_data_importer/rootfs/templates/cronupdate index 61de301cd..b9e8db10a 100644 --- a/fireflyiii_data_importer/rootfs/templates/cronupdate +++ b/fireflyiii_data_importer/rootfs/templates/cronupdate @@ -2,6 +2,10 @@ # shellcheck shell=bash set -e +# Source environment variables for cron context +# shellcheck disable=SC1091 +if [ -f /etc/environment ]; then set -a; . /etc/environment; set +a; fi + CONFIGSOURCE="$(bashio::config "CONFIG_LOCATION")" (