Skip to content

Commit

Permalink
fix details
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed Oct 4, 2023
1 parent b009cf8 commit c7b018e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ while ! nc -z nextcloud-aio-nextcloud 9001; do
done

set -x
# Reset the file
sed -i "/(GEOFILTER)/,$ d" /Cadddyfile

while ! [ -f /nextcloud/admin/files/nextcloud-aio-caddy/allowed-countries.txt ]; do
echo "Waiting for allowed-countries.txt file to be created"
sleep 5
done

ALLOW_CONTRIES="$(head -n 1 filename /nextcloud/admin/files/nextcloud-aio-caddy/allowed-countries.txt)"
ALLOW_CONTRIES="$(head -n 1 /nextcloud/admin/files/nextcloud-aio-caddy/allowed-countries.txt)"
if echo "$ALLOW_CONTRIES" | grep -q '^[A-Z ]\+$'; then
FILTER_SET=1
fi
Expand All @@ -29,7 +26,7 @@ if [ -f "/nextcloud/admin/files/nextcloud-aio-caddy/GeoLite2-Country.mmdb" ]; th
FILE_THERE=1
fi

if [ -n "$(dig A +short nextcloud-aio-vaultwarden)" ]; then
if [ -n "$(dig A +short nextcloud-aio-vaultwarden)" ] && ! grep -q nextcloud-aio-vaultwarden /Caddyfile; then
cat << CADDY >> /Caddyfile
https://bw.{\$NC_DOMAIN}:443 {
# import GEOFILTER
Expand All @@ -46,7 +43,9 @@ CADDY
fi

if [ "$FILTER_SET" = 1 ] && [ "$FILE_THERE" = 1 ]; then
sed -i "s|# import GEOFILTER|import GEOFILTER|" /Caddyfile
sed -i "s|# import GEOFILTER| import GEOFILTER|" /Caddyfile
else
sed -i "s| import GEOFILTER|# import GEOFILTER|" /Caddyfile
fi
set +x

Expand Down

0 comments on commit c7b018e

Please sign in to comment.