1
0
mirror of https://github.com/pi-hole/docker-pi-hole.git synced 2024-06-21 15:06:40 +02:00

Handles docker service names with ports.

Signed-off-by: haxwithaxe <spam@haxwithaxe.net>
This commit is contained in:
haxwithaxe 2022-03-14 18:02:41 -04:00
parent 1c24b96048
commit 06569a5bcd

View File

@ -129,10 +129,13 @@ if [ -n "${PIHOLE_DNS_}" ]; then
((valid_entries=valid_entries+1))
continue
fi
if [ -n "$(dig +short $i)" ]; then
if [ -n "$(dig +short ${i//#*/})" ]; then
# If the "address" is a domain (for example a docker link) then try to resolve it and add
# the result as a DNS server in setupVars.conf.
resolved_ip="$(dig +short $i | head -n 1)"
resolved_ip="$(dig +short ${i//#*/} | head -n 1)"
if [ -n "${i//*#/}" ]; then
resolved_ip="${resolved_ip}#${i//*#/}"
fi
echo "Resolved ${i} from PIHOLE_DNS_ as: ${resolved_ip}"
if valid_ip "$resolved_ip" || valid_ip6 "$resolved_ip" ; then
change_setting "PIHOLE_DNS_$count" "$resolved_ip"