Merge branch 'master' into 9-add-donotredirect-to-createvhosts-sh

This commit is contained in:
Lutchy Horace 2021-03-24 16:39:56 -04:00
commit 7472d403c5
1 changed files with 11 additions and 12 deletions

View File

@ -49,6 +49,15 @@ function reload_nginx
sleep 0.5
}
function clean_up
{
debug "Removing Nginx configuration and logs..."
rm $_vhost_conf_file
rm /var/log/nginx/$_domain.*
reload_nginx
err $1
}
function verify_vhost
{
local target=127.0.0.1
@ -72,12 +81,6 @@ function verify_vhost
fi
}
function rm_vhost_conf
{
echo "Removing Nginx configuration"
rm $_vhost_conf_file
}
_cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
_bootstrap=${_cwd}/bootstrap.sh
_bb_myname=$(basename "$0")
@ -262,16 +265,12 @@ reload_nginx
echo "Verifying vhost..."
if ! verify_vhost; then
rm_vhost_conf
reload_nginx
err "Failed to verify vhost"
clean_up "Failed to verify vhost"
fi
echo "Retrieving Let's Encrypt Certificate..."
if ! get_cert; then
rm_vhost_conf
reload_nginx
err "Failed to retrieve certificate!"
clean_up "Failed to retrieve certificate!"
fi
cat << EOF >> $_vhost_conf_file