stupid fixes

This commit is contained in:
Sebastian
2025-03-18 12:53:22 +01:00
parent 97c3396af0
commit 70036ec47b

View File

@@ -1,12 +1,12 @@
#!/bin/bash
#!/bin/bash
IPS=$(/usr/bin/docker exec -t wireguard curl 10.13.13.1:5000/storage | jq -r '[.[].ip]|join(",")' | sed 's/\n//g')
DIRTY_IPS=$(/usr/bin/docker exec -t wireguard curl 10.13.13.1:5000/storage | jq -r '[.[].ip]|join(",")' | sed 's/\n//g')
cleaned_ips=$(echo "$IPS" | sed -E 's/[^0-9.,]//g' | sed 's/,,*/,/g' | sed 's/,$//')
IPS=$(echo "$DIRTY_IPS" | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' | paste -sd "," -)
if [ -z "$cleaned_ips" ]; then
if [ -z "$IPS" ]; then
echo "whitelist empty"
else
sed -i.bak "s/WHITELIST=.*/WHITELIST=${cleaned_ips},192\.168\.0\.0\/16/g" /root/rpc/.env
sed -i.bak "s/WHITELIST=.*/WHITELIST=${IPS},192\.168\.0\.0\/16/g" /root/rpc/.env
cd /root/rpc && docker compose up -d traefik
fi