BTCPAY_HOST can be empty

This commit is contained in:
nicolas.dorier
2019-03-18 17:52:27 +09:00
parent e17902880f
commit bf708ce271

View File

@@ -74,11 +74,11 @@ if [ "$1" != "-i" ]; then
return
fi
if [ -z "$BTCPAY_HOST" ]; then
if [ -z "$BTCPAYGEN_CRYPTO1" ]; then
if [ -f "/etc/profile.d/btcpay-env.sh" ]; then
echo "This script must be run as root after running \"sudo su -\""
else
echo "BTCPAY_HOST should not be empty"
echo "BTCPAYGEN_CRYPTO1 should not be empty"
fi
return
fi
@@ -129,7 +129,7 @@ if [[ -f "$BTCPAY_HOST_SSHKEYFILE" ]]; then
done
fi
if [[ "$BTCPAYGEN_REVERSEPROXY" == "nginx" ]]; then
if [[ "$BTCPAYGEN_REVERSEPROXY" == "nginx" ]] && [[ "$BTCPAY_HOST" ]]; then
DOMAIN_NAME="$(echo "$BTCPAY_HOST" | grep -P '(?=^.{4,253}$)(^(?:[a-zA-Z0-9](?:(?:[a-zA-Z0-9\-]){0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$)')"
if [[ ! "$DOMAIN_NAME" ]]; then
echo "BTCPAYGEN_REVERSEPROXY is set to nginx, so BTCPAY_HOST must be a domain name which point to this server (with port 80 and 443 open), but the current value of BTCPAY_HOST ('$BTCPAY_HOST') is not a valid domain name."