#!/bin/bash

# shellcheck source=install/usr/bin/xivocc-installer-lib/xivo-configuration-helper.sh
source "/usr/bin/xivocc-installer-lib/xivo-configuration-helper.sh"

source_custom_env_file

if ! [[ "$XUC_HOST" =~ ^(([1-9]?[0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))\.){3}([1-9]?[0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))$ ]]; then
	echo -e "\e[1;31mVariable XUC_HOST in custom.env need to be an IP address before configuring the XiVO PBX. Exiting ...\e[0m"
	exit 1
fi

xivocc_configures_xivo_post_wizard
