Skip to content

Commit 700c04a

Browse files
committed
web: properly handle acme.sh return codes
It exits with 2 in case a renew is not necessary.
1 parent 4cb181c commit 700c04a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

web/rootfs/etc/cont-init.d/10-config

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ if [[ $DISABLE_HTTPS -ne 1 ]]; then
2323
fi
2424
export LE_WORKING_DIR="/config/acme.sh"
2525
# TODO: move away from standalone mode to webroot mode.
26-
if ! /config/acme.sh/acme.sh \
27-
$STAGING \
28-
--issue \
29-
--standalone \
30-
--pre-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -d /var/run/s6/services/nginx; fi" \
31-
--post-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -u /var/run/s6/services/nginx; fi" \
32-
-d $LETSENCRYPT_DOMAIN ; then
26+
/config/acme.sh/acme.sh \
27+
$STAGING \
28+
--issue \
29+
--standalone \
30+
--pre-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -d /var/run/s6/services/nginx; fi" \
31+
--post-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -u /var/run/s6/services/nginx; fi" \
32+
-d $LETSENCRYPT_DOMAIN
33+
rc=$?
34+
if [[ $rc -eq 1 ]]; then
3335
echo "Failed to obtain a certificate from the Let's Encrypt CA."
3436
# this tries to get the user's attention and to spare the
3537
# authority's rate limit:

0 commit comments

Comments
 (0)