Refactor bash [[ ... ]] && ... || ... into if then else

This commit is contained in:
Brandon Schmitt 2020-12-11 04:51:53 +01:00
parent c020cc88a1
commit ad4d4cc794
No known key found for this signature in database
GPG Key ID: F34558B1EBBD662B
1 changed files with 10 additions and 1 deletions

View File

@ -1095,7 +1095,16 @@ function _setup_ssl
local LETSENCRYPT_DOMAIN=""
local LETSENCRYPT_KEY=""
[[ -f /etc/letsencrypt/acme.json ]] && (_extract_certs_from_acme "${SSL_DOMAIN}" || _extract_certs_from_acme "${HOSTNAME}" || _extract_certs_from_acme "${DOMAINNAME}")
if [[ -f /etc/letsencrypt/acme.json ]]
then
if ! _extract_certs_from_acme "${SSL_DOMAIN}"
then
if ! _extract_certs_from_acme "${HOSTNAME}"
then
_extract_certs_from_acme "${DOMAINNAME}"
fi
fi
fi
# first determine the letsencrypt domain by checking both the full hostname or just the domainname if a SAN is used in the cert
if [[ -e /etc/letsencrypt/live/${HOSTNAME}/fullchain.pem ]]