瀏覽代碼

Export all environment variables to cron (#5772)

fix https://github.com/FreshRSS/FreshRSS/issues/5770
Note, the syntax complying with https://www.shellcheck.net/wiki/SC2002 does not seem to work in ash / Alpine
Alexandre Alapetite 2 年之前
父節點
當前提交
de51f6e7a0
共有 1 個文件被更改,包括 2 次插入7 次删除
  1. 2 7
      Docker/entrypoint.sh

+ 2 - 7
Docker/entrypoint.sh

@@ -34,13 +34,8 @@ if [ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ]; then
 fi
 
 if [ -n "$CRON_MIN" ]; then
-	(
-		echo "export TZ=$TZ"
-		echo "export COPY_LOG_TO_SYSLOG=$COPY_LOG_TO_SYSLOG"
-		echo "export COPY_SYSLOG_TO_STDERR=$COPY_SYSLOG_TO_STDERR"
-		echo "export FRESHRSS_ENV=$FRESHRSS_ENV"
-		echo "export DATA_PATH=$DATA_PATH"
-	) >/var/www/FreshRSS/Docker/env.txt
+	# shellcheck disable=SC2002
+	cat /proc/self/environ | tr '\0' '\n' | grep -vE '^(HOME|PATH|PWD|SHLVL|TERM|_)=' | sort -u | sed 's/^/export /' >/var/www/FreshRSS/Docker/env.txt
 	sed </etc/crontab.freshrss.default \
 		-r "s#^[^ ]+ #$CRON_MIN #" | crontab -
 fi