[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:
parent
2487c1397c
commit
112768e71f
|
@ -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"}]
|
||||
},
|
2
start.sh
2
start.sh
|
@ -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
|
||||
|
|
6
util.sh
6
util.sh
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue