rework macro verification

This commit is contained in:
Matthew Saunders Brown 2023-05-17 15:48:00 -07:00
parent 8c99b89947
commit 4c688b2bc6

View File

@ -50,15 +50,8 @@ if [[ ! -n $domain ]]; then
exit
fi
# check for macro
if [[ -n $macro ]]; then
if [[ " ${macro_array[@]} " =~ " ${macro} " ]]; then
macro_vhost_line="Use $macro"
else
echo "invalid macro name"
exit 1
fi
else
# autodetect macro to use if not set
if [[ ! -n $macro ]]; then
if [[ "$domain" =~ ^mail.* ]]; then
macro=VMailHTTPS
elif [[ -f "/etc/ssl/letsencrypt/$domain.pem" ]]; then
@ -67,6 +60,13 @@ else
macro=VHostHTTP
fi
fi
# verify macro name
if [[ " ${macro_array[@]} " =~ " ${macro} " ]]; then
macro_vhost_line="Use $macro"
else
echo "invalid macro name"
exit 1
fi
# if https check for le cert
if [[ "$macro" == *"HTTPS"* ]]; then