summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/main.go b/main.go
index 511b434..80247e8 100644
--- a/main.go
+++ b/main.go
@@ -11,6 +11,7 @@ import (
//go:embed simple.css/simple.css templates/index.html
var static embed.FS
+var templates *template.Template
func main() {
configPath := parseFlags()
@@ -37,13 +38,13 @@ func parseFlags() string {
// index() returns a HTTP handler for the index page.
func index(devices DevicesConfig) func(http.ResponseWriter, *http.Request) {
- tmpl, err := template.ParseFS(static, "templates/index.html")
+ templates, err := template.ParseFS(static, "templates/index.html")
if err != nil {
log.Fatal(err)
}
return func(w http.ResponseWriter, r *http.Request) {
- err = tmpl.Execute(w, devices)
+ err = templates.Execute(w, devices)
if err != nil {
http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
return