Closes #10: Delete nginx conf on certificate retrieval failure

This commit is contained in:
Lutchy Horace 2021-03-19 11:14:22 -04:00
parent 0f3dfc0819
commit 89fceaba29
1 changed files with 5 additions and 1 deletions

View File

@ -28,6 +28,7 @@ function usage
function get_cert
{
/root/.acme.sh/acme.sh --issue --domain $_domain --webroot /srv/http-content-combined/ --cert-file /etc/nginx/ssl/${_domain}.crt --key-file /etc/nginx/ssl/${_domain}.key --fullchain-file /etc/nginx/ssl/${_domain}-fullchain.crt
return $?
}
function reload_nginx
@ -172,7 +173,10 @@ echo "Reloading Nginx..."
reload_nginx
echo "Retrieving Let's Encrypt Certificate..."
get_cert
if ! get_cert; then
rm $_vhost_conf_file
err "Failed to retrieve certificate!"
fi
cat << EOF >> $_vhost_conf_file