Skip to content

Commit

Permalink
web: properly handle acme.sh return codes
Browse files Browse the repository at this point in the history
It exits with 2 in case a renew is not necessary.
  • Loading branch information
saghul committed Dec 4, 2020
1 parent 4cb181c commit 700c04a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions web/rootfs/etc/cont-init.d/10-config
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ if [[ $DISABLE_HTTPS -ne 1 ]]; then
fi
export LE_WORKING_DIR="/config/acme.sh"
# TODO: move away from standalone mode to webroot mode.
if ! /config/acme.sh/acme.sh \
$STAGING \
--issue \
--standalone \
--pre-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -d /var/run/s6/services/nginx; fi" \
--post-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -u /var/run/s6/services/nginx; fi" \
-d $LETSENCRYPT_DOMAIN ; then
/config/acme.sh/acme.sh \
$STAGING \
--issue \
--standalone \
--pre-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -d /var/run/s6/services/nginx; fi" \
--post-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -u /var/run/s6/services/nginx; fi" \
-d $LETSENCRYPT_DOMAIN
rc=$?
if [[ $rc -eq 1 ]]; then
echo "Failed to obtain a certificate from the Let's Encrypt CA."
# this tries to get the user's attention and to spare the
# authority's rate limit:
Expand Down

0 comments on commit 700c04a

Please sign in to comment.