Skip to content

Commit

Permalink
Added force renew option
Browse files Browse the repository at this point in the history
  • Loading branch information
Menkveld-24 committed Feb 22, 2023
1 parent 2fc92b3 commit a448f3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
| CURL_DEBUG | Adds the -v flag to curl requests | false | N |
| CURL_QUIET | Displays curl output in terminal (including certificates) | false | N |
| CURL_IGNORESSL | Ignore ssl errors when making requests to APISIX | true | N |
| FORCE_RENEW | Force certbot to renew the certificate if it doesn't want to | false | N |

##### Tip: mount /etc/letsencrypt to a volume or sth to prevent certbot from making a new account each run

### Versions
Version overview, this is not fully tested on all versions
Expand Down
7 changes: 4 additions & 3 deletions certer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ ignoreSSL=$([ $CURL_IGNORESSL == "true" ] && echo "-k" || echo "")
showOutput=$([ $CURL_QUIET == "true" ] && echo "-o /dev/null" || echo "-o /tmp/debug_body")
debugCurl=$([ $CURL_DEBUG == "true" ] && echo "-v" || echo "")
agreeCertbotTOS=$([ $AGREE_TOS == "true" ] && echo "--agree-tos" || echo "")
forceRenew=$([ $FORCE_RENEW == "true" ] && echo "--force-renew" || echo "")

echo "[CERTER} v1.0.0"
echo "[CERTER] v1.1.0"
echo "[CERTER] Generating certificates for: $domain"

# Validate the response of any curl
Expand Down Expand Up @@ -59,10 +60,10 @@ echo "[CERTER] Created temporary acme challenge route!"
echo "[CERTER] Certbot output vvvvvvvvvvvvvvvvvvvvvv"
if [[ $stagingOrProd == "production" ]]; then
echo "[CERTER] Generating production certificates...."
certbot certonly --standalone --domains $domain --email $mail $agreeCertbotTOS --non-interactive
certbot certonly --standalone --domains $domain --email $mail $agreeCertbotTOS --non-interactive $forceRenew
else
echo "[CERTER] Generating staging certificates...."
certbot certonly --standalone --staging --domains $domain --email $mail $agreeCertbotTOS --non-interactive
certbot certonly --standalone --staging --domains $domain --email $mail $agreeCertbotTOS --non-interactive $forceRenew
fi
echo "[CERTER] Certbot output ^^^^^^^^^^^^^^^^^^^^^^"
echo "[CERTER] Generated certificates!"
Expand Down

0 comments on commit a448f3a

Please sign in to comment.