Skip to content

Commit bf75338

Browse files
cowwocjaydrogers
andauthored
Fixes #1: Support for multiple domains (#5)
Co-authored-by: Jay Rogers <[email protected]>
1 parent 4766549 commit bf75338

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<p align="center">
1+
<p style="text-align: center">
22
<img src="https://raw.githubusercontent.com/serversideup/docker-certbot-dns-cloudflare/main/.github/header.png" width="1200" alt="Docker Images Logo">
33
</p>
4-
<p align="center">
4+
<p style="text-align: center">
55
<a href="https://actions-badge.atrox.dev/serversideup/docker-certbot-dns-cloudflare/goto?ref=main"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fserversideup%2Fdocker-proftpd%2Fbadge%3Fref%3Dmain&style=flat" /></a>
66
<a href="https://github.com/serversideup/docker-certbot-dns-cloudflare/blob/main/LICENSE" target="_blank"><img src="https://badgen.net/github/license/serversideup/docker-certbot-dns-cloudflare" alt="License"></a>
77
<a href="https://github.com/sponsors/serversideup"><img src="https://badgen.net/badge/icon/Support%20Us?label=GitHub%20Sponsors&color=orange" alt="Support us"></a>
@@ -30,13 +30,13 @@ The image is based on `certbot/dns-cloudflare:latest`, providing a stable and up
3030

3131
The following environment variables can be used to customize the Certbot container:
3232

33-
| Variable | Description | Default Value |
34-
|----------|-------------|---------------|
35-
| `CERTBOT_DOMAIN` | Domain for which to obtain the certificate | - |
36-
| `CERTBOT_EMAIL` | Email address for Let's Encrypt notifications | - |
37-
| `CERTBOT_KEY_TYPE` | Type of private key to generate | `ecdsa` |
38-
| `CLOUDFLARE_API_TOKEN` | Cloudflare API token for DNS authentication | - |
39-
| `RENEWAL_INTERVAL` | Interval between certificate renewal checks | 43200 seconds (12 hours) |
33+
| Variable | Description | Default Value |
34+
|------------------------|---------------------------------------------------------------------|---------------|
35+
| `CERTBOT_DOMAINS` | Comma-separated list of domains for which to obtain the certificate | - |
36+
| `CERTBOT_EMAIL` | Email address for Let's Encrypt notifications | - |
37+
| `CERTBOT_KEY_TYPE` | Type of private key to generate | `ecdsa` |
38+
| `CLOUDFLARE_API_TOKEN` | Cloudflare API token for DNS authentication | - |
39+
| `RENEWAL_INTERVAL` | Interval between certificate renewal checks | 43200 seconds (12 hours) |
4040

4141
## Usage
4242

@@ -52,7 +52,7 @@ The following environment variables can be used to customize the Certbot contain
5252
5353
```sh
5454
docker run \
55-
-e CERTBOT_DOMAIN="yourdomain.com" \
55+
-e CERTBOT_DOMAINS="yourdomain.com" \
5656
-e CERTBOT_EMAIL="[email protected]" \
5757
-e CLOUDFLARE_API_TOKEN="your-cloudflare-api-token" \
5858
-v /path/to/your/certs:/etc/letsencrypt \
@@ -72,7 +72,7 @@ We designed this image to work great in orchestrated deployments like Kubernetes
7272
environment:
7373
CLOUDFLARE_API_TOKEN: "${CLOUDFLARE_API_TOKEN}"
7474
CERTBOT_EMAIL: "${CERTBOT_EMAIL}"
75-
CERTBOT_DOMAIN: "${CERTBOT_DOMAIN}"
75+
CERTBOT_DOMAINS: "${CERTBOT_DOMAINS}"
7676
CERTBOT_KEY_TYPE: "rsa"
7777

7878
volumes:
@@ -97,7 +97,7 @@ Need help getting started? Join our Discord community and we'll help you out!
9797
## Our Sponsors
9898
All of our software is free an open to the world. None of this can be brought to you without the financial backing of our sponsors.
9999
100-
<p align="center"><a href="https://github.com/sponsors/serversideup"><img src="https://521public.s3.amazonaws.com/serversideup/sponsors/sponsor-box.png" alt="Sponsors"></a></p>
100+
<p style="text-align: center"><a href="https://github.com/sponsors/serversideup"><img src="https://521public.s3.amazonaws.com/serversideup/sponsors/sponsor-box.png" alt="Sponsors"></a></p>
101101
102102
#### Bronze Sponsors
103103
<!-- bronze -->No bronze sponsors yet. <a href="https://github.com/sponsors/serversideup">Become a sponsor →</a><!-- bronze -->
@@ -108,7 +108,7 @@ All of our software is free an open to the world. None of this can be brought to
108108
## About Us
109109
We're [Dan](https://twitter.com/danpastori) and [Jay](https://twitter.com/jaydrogers) - a two person team with a passion for open source products. We created [Server Side Up](https://serversideup.net) to help share what we learn.
110110
111-
<div align="center">
111+
<div style="text-align: center">
112112
113113
| <div align="center">Dan Pastori</div> | <div align="center">Jay Rogers</div> |
114114
| ----------------------------- | ------------------------------------------ |

src/entrypoint.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,20 @@ cat << "EOF"
1111
|| ||
1212
EOF
1313

14+
if [ -n "$CERTBOT_DOMAIN" ] && [ -z "$CERTBOT_DOMAINS" ]; then
15+
CERTBOT_DOMAINS=$CERTBOT_DOMAIN
16+
fi
17+
1418
echo "🚀 Let's Get Encrypted! 🚀"
15-
echo "🌐 Domain: $CERTBOT_DOMAIN"
19+
echo "🌐 Domain(s): $CERTBOT_DOMAINS"
1620
echo "📧 Email: $CERTBOT_EMAIL"
1721
echo "🔑 Key Type: $CERTBOT_KEY_TYPE"
1822
echo "⏰ Renewal Interval: $RENEWAL_INTERVAL seconds"
1923
echo "Let's Encrypt, shall we?"
2024
echo "-----------------------------------------------------------"
2125

2226
# Validate required environment variables
23-
for var in CLOUDFLARE_API_TOKEN CERTBOT_DOMAIN CERTBOT_EMAIL CERTBOT_KEY_TYPE; do
27+
for var in CLOUDFLARE_API_TOKEN CERTBOT_DOMAINS CERTBOT_EMAIL CERTBOT_KEY_TYPE; do
2428
if [ -z "$(eval echo \$$var)" ]; then
2529
echo "Error: $var environment variable is not set"
2630
exit 1
@@ -35,7 +39,7 @@ run_certbot() {
3539
certbot certonly \
3640
--dns-cloudflare \
3741
--dns-cloudflare-credentials /cloudflare.ini \
38-
-d "$CERTBOT_DOMAIN" \
42+
-d "$CERTBOT_DOMAINS" \
3943
--key-type "$CERTBOT_KEY_TYPE" \
4044
--email "$CERTBOT_EMAIL" \
4145
--agree-tos \

0 commit comments

Comments
 (0)