Skip to content

Commit b43c3d9

Browse files
committed
Fix: spaces -> tabs
1 parent 07b46c7 commit b43c3d9

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

scripts/common.sh

+21-21
Original file line numberDiff line numberDiff line change
@@ -289,28 +289,28 @@ convert_plugin_names_to_filter_names() {
289289
# that at least one works
290290
###################################################################
291291
get_public_ip() {
292-
local services=(https://ipinfo.io/ip https://ifconfig.me/ip https://icanhazip.com https://ipecho.net/ip https://ifconfig.co https://myexternalip.com/raw)
292+
local services=(https://ipinfo.io/ip https://ifconfig.me/ip https://icanhazip.com https://ipecho.net/ip https://ifconfig.co https://myexternalip.com/raw)
293293
local ip
294-
if [[ -n "${AUTOSET_HOSTNAME_SERVICES}" ]]; then
295-
services=("${AUTOSET_HOSTNAME_SERVICES}")
296-
notice "Using user defined ${emphasis}AUTOSET_HOSTNAME_SERVICES${reset}=${emphasis}${AUTOSET_HOSTNAME_SERVICES}${reset} for IP detection"
297-
else
298-
debug "Public IP detection will use ${emphasis}${services}${reset} to detect the IP."
299-
fi
300-
301-
for service in "${services[@]}"; do
302-
if ip="$(curl --fail-early --retry-max-time 30 --retry 10 --connect-timeout 5 --max-time 10 -s)"; then
303-
# Some services, such as ifconfig.co will return a line feed at the end of the response.
304-
ip="$(printf "%s" "${ip}" | trim)"
305-
if [[ -n "${ip}" ]]; then
306-
info "Detected public IP address as ${emphasis}${services}${ip}${reset}."
307-
break
308-
fi
309-
fi
310-
done
311-
312-
error "Unable to detect public IP. Please check your internet connection and firewall settings."
313-
return 1
294+
if [[ -n "${AUTOSET_HOSTNAME_SERVICES}" ]]; then
295+
services=("${AUTOSET_HOSTNAME_SERVICES}")
296+
notice "Using user defined ${emphasis}AUTOSET_HOSTNAME_SERVICES${reset}=${emphasis}${AUTOSET_HOSTNAME_SERVICES}${reset} for IP detection"
297+
else
298+
debug "Public IP detection will use ${emphasis}${services}${reset} to detect the IP."
299+
fi
300+
301+
for service in "${services[@]}"; do
302+
if ip="$(curl --fail-early --retry-max-time 30 --retry 10 --connect-timeout 5 --max-time 10 -s)"; then
303+
# Some services, such as ifconfig.co will return a line feed at the end of the response.
304+
ip="$(printf "%s" "${ip}" | trim)"
305+
if [[ -n "${ip}" ]]; then
306+
info "Detected public IP address as ${emphasis}${services}${ip}${reset}."
307+
break
308+
fi
309+
fi
310+
done
311+
312+
error "Unable to detect public IP. Please check your internet connection and firewall settings."
313+
return 1
314314
}
315315

316316
export reset green yellow orange orange_emphasis lightblue red gray emphasis underline

0 commit comments

Comments
 (0)