From 53355cff64a6b71857f06bf99bd89e429c5a1acf Mon Sep 17 00:00:00 2001
From: Massimiliano Adamo <maxadamo@gmail.com>
Date: Wed, 22 Jan 2025 20:58:47 +0100
Subject: [PATCH] feat: add additional URL endpoints

---
 main.go | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/main.go b/main.go
index 1d63690..3d085b1 100644
--- a/main.go
+++ b/main.go
@@ -169,25 +169,27 @@ Options:
 	} else {
 		InfoLogger.Printf("Starting ACME Web server")
 	}
-
 	for _, provider := range acmeProviders {
 		baseURLs = append(baseURLs, "/"+provider, "/"+provider+"/")
 	}
-
+	for _, provider := range acmeProviders {
+		otherURLs = append(otherURLs, "/"+provider+"/by_name.html", "/"+provider+"/by_date.html")
+	}
 	for _, provider := range acmeProviders {
 		apiURLs = append(
 			apiURLs, "/api/"+provider, "/api/"+provider+"/",
 			"/api/"+provider+"/"+provider+".json", "/api/"+provider+"/"+provider+"_expired.json",
 		)
 	}
-
-	for _, provider := range acmeProviders {
-		otherURLs = append(otherURLs, "/"+provider+"/by_name.html", "/"+provider+"/by_date.html")
+	if verboseBool {
+		DebugLogger.Printf("Serving baseURLs: %v", baseURLs)
+		DebugLogger.Printf("Serving apiURLs: %v", apiURLs)
+		DebugLogger.Printf("Serving otherURLs: %v", otherURLs)
 	}
 
 	puppetURL := "/puppet"
 
-	fs := http.FileServer(http.Dir("/var/www/acme_web/static"))
+	fs := http.FileServer(http.Dir(filepath.Join(webDir, "static")))
 	http.Handle("/static/", http.StripPrefix("/static/", fs))
 
 	http.HandleFunc(puppetURL, triggerPuppet)
-- 
GitLab