[mod] move rules.json to rules.json.template

start.sh create rules.json from rules.json.template. It replaces $CHECK_SEARX_SPACE_IPS by the IPs of check.searx.space.

Related to https://github.com/asciimoo/filtron/issues/12
This commit is contained in:
Dalf 2020-07-10 10:46:01 +02:00
parent 2487c1397c
commit 112768e71f
3 changed files with 9 additions and 1 deletions

View File

@ -1,7 +1,7 @@
[
{
"name": "searx.space",
"filters": ["Header:X-Forwarded-For=(2001:41d0:8:de3::1|176.31.252.227)"],
"filters": ["Header:X-Forwarded-For=$CHECK_SEARX_SPACE_IPS"],
"stop": true,
"actions": [{ "name": "log"}]
},

View File

@ -5,6 +5,8 @@ cd -- "$BASE_DIR"
. ./util.sh
create_rules_json "check.searx.space" > rules.json
$DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE down -v
$DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE rm -fv
$DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE up

View File

@ -24,3 +24,9 @@ if [ ! -f "${DOCKERCOMPOSEFILE}" ]; then
echo "${DOCKERCOMPOSEFILE} not found" 1>&2
exit 1
fi
create_rules_json() {
# $1 : requests host name $1 will bypass filtron
IPS="($(host $1 | rev | cut -d\ -f1 | rev | tr '\n' '|' | sed 's/.$//'))"
sed "s/\$CHECK_SEARX_SPACE_IPS/$IPS/" rules.json.template
}