Test for empty values in the PIHOLE_DNS_ array, skip if it's empty
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
1daeb117cb
commit
939a69b895
|
@ -267,10 +267,11 @@ setup_FTL_upstream_DNS(){
|
|||
# Split into an array (delimited by ;)
|
||||
# Loop through and add them one by one to setupVars.conf
|
||||
IFS=";" read -r -a PIHOLE_DNS_ARR <<< "${PIHOLE_DNS_}"
|
||||
# PIHOLE_DNS_ARR=(${PIHOLE_DNS_//;/ })
|
||||
count=1
|
||||
valid_entries=0
|
||||
for i in "${PIHOLE_DNS_ARR[@]}"; do
|
||||
# Ensure we don't have an empty value first (see https://github.com/pi-hole/docker-pi-hole/issues/1174#issuecomment-1228763422 )
|
||||
if [ -n "$i" ]; then
|
||||
if valid_ip "$i" || valid_ip6 "$i" ; then
|
||||
change_setting "PIHOLE_DNS_$count" "$i"
|
||||
((count=count+1))
|
||||
|
@ -295,6 +296,7 @@ setup_FTL_upstream_DNS(){
|
|||
fi
|
||||
# If the above tests fail then this is an invalid DNS server
|
||||
echo "Invalid entry detected in PIHOLE_DNS_: ${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $valid_entries -eq 0 ]; then
|
||||
|
|
Loading…
Reference in New Issue