Skip to content

Commit

Permalink
fix: #239 ip address selection
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdan-shulha committed Oct 18, 2024
1 parent d82db3d commit 683a467
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/self-hosted/install-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ choose_ip_address() {
header "$prompt"
echo "$help_text"

if [ ${#ip_array[@]} -eq 0 ]; then
echo "$(red "No IP addresses found.")"
echo "$(red "Please check your network configuration.")"
exit 1
fi

if [ ${#ip_array[@]} -eq 1 ]; then
local chosen_ip="${ip_array[0]}"
echo -e "$(green "Only one IP address available:") $(cyan "$chosen_ip")\n"
Expand Down Expand Up @@ -214,7 +220,7 @@ get_user_credentials() {
echo -e "\n$(green "Credentials saved successfully.")"
}

IP_LIST=$(/tmp/ptah-agent list-ips)
IP_LIST="$(/tmp/ptah-agent list-ips | tr -d '\n')"
choose_ip_address "$IP_LIST" "Advertised IP addresses" "ADVERTISE_ADDR" "$ADVERTISED_IP_HELP"
choose_ip_address "$IP_LIST" "Public IP address" "PUBLIC_IP" "$PUBLIC_IP_HELP"

Expand Down

0 comments on commit 683a467

Please sign in to comment.