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 image: bitdeals/certbot
environment: environment:
- DOMAIN= - DOMAIN=
- EMAIL=
volumes: volumes:
- certificates:/etc/certificates - certificates:/etc/certificates
- letsencrypt:/etc/letsencrypt - 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 cat site.key site.crt >> /etc/certificates/site.pem
fi 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 if [ -n "$DOMAIN" ]; then
# Request certificate # Request certificate
certbot certonly --standalone \ certbot certonly --standalone \
--non-interactive --agree-tos --http-01-port=380 \ --non-interactive --agree-tos --http-01-port=380 \
--register-unsafely-without-email \ "$CERTBOT_OPTS" \
--cert-name "$DOMAIN" \ --cert-name "$DOMAIN" \
-d "$DOMAIN" -d "$DOMAIN"