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>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-23 12:33:50 +00:00
parent ae6a0689fe
commit 9893ad41dc
3 changed files with 16 additions and 1 deletions

View File

@@ -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

View File

@@ -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 #
################

View File

@@ -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")"
(