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