Skip to content

Commit

Permalink
Merge pull request #137 from Suwayomi/main
Browse files Browse the repository at this point in the history
actually support ipv6
  • Loading branch information
Robonau authored Jan 18, 2024
2 parents 360d37b + 42d98a5 commit 2461cdc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion set-env-variable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
# exec "$@"

TMP=$(echo "$suwayomi" | sed "s@/\$@@")
TMP2=$(awk '$1=="nameserver" && $2~/^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])\.?){4}$/ {print $2}' /etc/resolv.conf)

# get the resolver IPs from /etc/resolv.conf and make them nginx syntax
TMP2=$(awk '
#if ipv4 print it
$1=="nameserver" && $2~/^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])\.?){4}$/{
print $2
}
# if the ip isnt ipv4 assume its ipv6 and surround it in []
$1=="nameserver" && $2!~/^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])\.?){4}$/{
print "["$2"]"
}' /etc/resolv.conf)
sed -i "s@resolverPLACEHOLDER@$TMP2@" /etc/nginx/conf.d/default.conf
sed -i "s@PLACEHOLDER@$TMP@" /etc/nginx/conf.d/default.conf

0 comments on commit 2461cdc

Please sign in to comment.