From a9930c02a33fe94141cd651212b5a815095c77ba Mon Sep 17 00:00:00 2001 From: Emile Date: Fri, 16 Aug 2024 22:40:26 +0200 Subject: make template path configurable --- src/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/http.go') diff --git a/src/http.go b/src/http.go index 894542a..0b7481e 100644 --- a/src/http.go +++ b/src/http.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "html/template" "net/http" ) @@ -40,7 +41,7 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { } // get the template - t, err := template.ParseGlob("./templates/*.html") + t, err := template.ParseGlob(fmt.Sprintf("%s/*.html", templatesPath)) if err != nil { w.WriteHeader(http.StatusInternalServerError) w.Write([]byte("500 - Error reading template file")) -- cgit 1.4.1