From 9adcc2f1a753fcaff61c6202654dfb64f3c3d1bb Mon Sep 17 00:00:00 2001 From: Cyril Chaboisseau Date: Sat, 1 May 2021 14:51:28 +0200 Subject: [PATCH] more optimized way to generate map referrer file --- scripts/referrers.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/referrers.sh b/scripts/referrers.sh index 6f4932e..38f426c 100755 --- a/scripts/referrers.sh +++ b/scripts/referrers.sh @@ -19,12 +19,7 @@ BLACKLIST="$(curl -s https://raw.githubusercontent.com/mitchellkrogza/nginx-ulti if [ "$?" -ne 0 ] ; then job_log "[BLACKLIST] can't update referrers list" fi -DATA="" -IFS=$'\n' -for ref in $BLACKLIST ; do - DATA="${DATA}\"~${ref}\" yes;\n" -done -echo -e "map \$http_referer \$bad_referrer { hostnames; default no; $DATA }" > /tmp/map-referrer.conf +echo -e "map \$http_referer \$bad_referrer { hostnames; default no; $(echo $DATA | sed 's/^/"~/;s/$/" yes;/') }" > /tmp/map-referrer.conf # check number of lines lines="$(wc -l /tmp/map-referrer.conf | cut -d ' ' -f 1)"