diff --git a/scripts/util.sh b/scripts/util.sh index d7b60e3..4585fa9 100644 --- a/scripts/util.sh +++ b/scripts/util.sh @@ -59,7 +59,18 @@ auto_enable_configs() { # EMAIL environment variable, to register the proper support email address. get_certificate() { echo "Getting certificate for domain $1 on behalf of user $2" + PRODUCTION_URL='https://acme-v01.api.letsencrypt.org/directory' + STAGING_URL='https://acme-staging.api.letsencrypt.org/directory' + + if [[ ! "${IS_STAGING}" = "1" ]]; then + LETSENCRYPT_URL=STAGING_URL + echo "Staging on" + else + LETSENCRYPT_URL=PRODUCTION_URL + echo "Production on" + fi + certbot certonly --agree-tos --keep -n --text --email $2 --server \ - https://acme-v01.api.letsencrypt.org/directory -d $1 --http-01-port 1337 \ + $LETSENCRYPT_URL -d $1 --http-01-port 1337 \ --standalone --standalone-supported-challenges http-01 --debug }