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/battle.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/battle.go') diff --git a/src/battle.go b/src/battle.go index 3d418f2..4c36327 100644 --- a/src/battle.go +++ b/src/battle.go @@ -364,7 +364,7 @@ func battlesHandler(w http.ResponseWriter, r *http.Request) { data["battles"] = battles // 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")) @@ -427,7 +427,7 @@ func battleNewHandler(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")) @@ -628,7 +628,7 @@ func battleSingleHandler(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