add optional e-mail

This commit is contained in:
2024-11-05 16:52:21 +03:00
parent ce357978a4
commit a5533e43ec
2 changed files with 8 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ services:
image: bitdeals/certbot
environment:
- DOMAIN=
- EMAIL=
volumes:
- certificates:/etc/certificates
- letsencrypt:/etc/letsencrypt

View File

@@ -10,13 +10,19 @@ if [ ! -f /etc/certificates/site.pem ]; then
cat site.key site.crt >> /etc/certificates/site.pem
fi
# check e-mail for letsencrypt notifications
if [ -n "$EMAIL" ]; then
CERTBOT_OPTS="--email $EMAIL"
else
CERTBOT_OPTS="--register-unsafely-without-email"
fi
if [ -n "$DOMAIN" ]; then
# Request certificate
certbot certonly --standalone \
--non-interactive --agree-tos --http-01-port=380 \
--register-unsafely-without-email \
"$CERTBOT_OPTS" \
--cert-name "$DOMAIN" \
-d "$DOMAIN"