INNER CODE UNIT · Shell
$ENDPOINT
IAmStoxe/wirehole · scripts/migrate-from-v1.sh:273
elif [[ $ENDPOINT =~ ^(.+):([0-9]+)$ ]]; then
ENDPOINT_HOST="${BASH_REMATCH[1]}"
ENDPOINT_PORT="${BASH_REMATCH[2]}"
fi
PUBLISHED_PORT=""
if container_exists wireguard; then
PUBLISHED_PORT="$(docker port wireguard 51820/udp 2> /dev/null \
| sed -nE '1{s/.*:([0-9]+)$/\1/p;}' || true)"
fi
VPN_PORT_VALUE="${PUBLISHED_PORT:-${ENDPOINT_PORT:-51820}}"
VPN_HOST_VALUE="${ENDPOINT_HOST:-$OLD_UI_HOST}"
if [[ -z $VPN_HOST_VALUE ]]; then
VPN_HOST_VALUE="$(curl -fsS --max-time 10 https://api.ipify.org 2> /dev/null || true)"
fi
[[ -n $VPN_HOST_VALUE ]] || die "could not determine VPN_HOST from a peer, wireguard-ui, or the public IP"