Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Commit 14ef9c8

Browse files
committed
docs(Makefile, README.md): clarify SSL command descriptions for better user understanding
Update the descriptions of SSL management commands in the Makefile and README.md to specify that `ssl-setup` should be run only if no certificates exist and `ssl-renew` should be used only if needed. This provides clearer guidance to users on when to use these commands and prevents unnecessary operations. fix(scripts/ssl-manager.sh): add checks for existing certificates before issuing or renewing Add checks in `issue_certificates` and `renew_certificates` functions to determine if certificates already exist or are valid before proceeding. This prevents redundant operations and guides users to use the correct command based on the certificate status.
1 parent bc84ea6 commit 14ef9c8

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,14 @@ help-ssl:
369369
@echo "SSL/TLS Certificate Management Commands:"
370370
@echo ""
371371
@echo "Simplified SSL Management:"
372-
@echo " ssl-setup - Setup certificates (one-time)"
373-
@echo " ssl-renew - Renew certificates"
372+
@echo " ssl-setup - Setup certificates (only if none exist)"
373+
@echo " ssl-renew - Renew certificates (only if needed)"
374374
@echo " ssl-status - Check certificate status"
375375
@echo ""
376376
@echo "Quick Start:"
377377
@echo " 1. Copy cloudflare-credentials.ini.template to cloudflare-credentials.ini"
378378
@echo " 2. Add your Cloudflare API token to cloudflare-credentials.ini"
379-
@echo " 3. make ssl-setup # Initial certificate setup"
379+
@echo " 3. make ssl-setup # Initial certificate setup (safe to run multiple times)"
380380
@echo " 4. make ssl-status # Check certificate status"
381381

382382
# Docker operations

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,12 @@ make up
215215
# Check certificate status
216216
make ssl-status
217217

218-
# Force renewal
218+
# Renew certificates (only if needed)
219219
make ssl-renew
220220

221+
# Setup certificates (only if none exist)
222+
make ssl-setup
223+
221224
# Direct script usage
222225
./scripts/ssl-manager.sh status
223226
./scripts/ssl-manager.sh renew
@@ -226,8 +229,8 @@ make ssl-renew
226229
### 🔧 **Available Commands**
227230

228231
```bash
229-
make ssl-setup # Setup certificates (one-time)
230-
make ssl-renew # Renew certificates
232+
make ssl-setup # Setup certificates (only if none exist)
233+
make ssl-renew # Renew certificates (only if needed)
231234
make ssl-status # Check certificate status
232235
```
233236

scripts/ssl-manager.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ check_prerequisites() {
5959

6060
# Issue new certificates
6161
issue_certificates() {
62+
log_info "Checking if certificates already exist..."
63+
64+
# Check if certificates already exist and are valid
65+
if check_status >/dev/null 2>&1; then
66+
log_info "Valid certificates already exist for $DOMAIN"
67+
log_info "Use 'make ssl-renew' if you need to renew them"
68+
return 0
69+
fi
70+
6271
log_info "Issuing SSL certificates for $DOMAIN..."
6372

6473
# Run certbot container to issue certificates
@@ -82,6 +91,15 @@ issue_certificates() {
8291

8392
# Renew existing certificates
8493
renew_certificates() {
94+
log_info "Checking certificate status before renewal..."
95+
96+
# Check if certificates exist
97+
if ! check_status >/dev/null 2>&1; then
98+
log_error "No valid certificates found to renew"
99+
log_info "Use 'make ssl-setup' to issue new certificates first"
100+
return 1
101+
fi
102+
85103
log_info "Renewing SSL certificates..."
86104

87105
# Run certbot container to renew certificates

0 commit comments

Comments
 (0)