footer und AppVersion eingebaut
All checks were successful
Docker Release Build / push_to_registry (push) Successful in 1m2s

This commit is contained in:
Florian Walther
2026-02-07 16:45:02 +01:00
parent dd8eab7975
commit c9296beb5f
5 changed files with 55 additions and 6 deletions

25
main.go
View File

@@ -12,13 +12,30 @@ const (
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
)
//var tmpl *template.Template
var templates = make(map[string]*template.Template)
var AppVersion = "development"
func loadTemplates() {
templates["index.html"] = template.Must(template.ParseFiles("templates/base.html", "templates/index.html"))
templates["help.html"] = template.Must(template.ParseFiles("templates/base.html", "templates/help.html"))
log.Printf("Alle Templates erfolgreich geladen")
// 1. FuncMap definieren
funcMap := template.FuncMap{
"getAppVersion": func() string {
return AppVersion
},
}
// 2. Templates mit FuncMap laden
// Wir nutzen New("base.html"), da base.html meist das Haupt-Layout definiert
templates["index.html"] = template.Must(template.New("base.html").Funcs(funcMap).ParseFiles(
"templates/base.html",
"templates/index.html",
))
templates["help.html"] = template.Must(template.New("base.html").Funcs(funcMap).ParseFiles(
"templates/base.html",
"templates/help.html",
))
log.Printf("Alle Templates erfolgreich geladen")
}
func generatePassword() string {