mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Allow to overwrite legal texts
This commit is contained in:
parent
c7c83fc08c
commit
29b6022f97
18
web/web.go
18
web/web.go
@ -9,6 +9,7 @@ import (
|
||||
"html/template"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/ClusterCockpit/cc-backend/internal/auth"
|
||||
@ -46,6 +47,23 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
|
||||
if path == "templates/imprint.tmpl" {
|
||||
if _, err := os.Stat("./var/imprint.tmpl"); err == nil {
|
||||
log.Info("overwrite imprint.tmpl with local file")
|
||||
templates[strings.TrimPrefix(path, "templates/")] =
|
||||
template.Must(template.Must(base.Clone()).ParseFiles("./var/imprint.tmpl"))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if path == "templates/privacy.tmpl" {
|
||||
if _, err := os.Stat("./var/privacy.tmpl"); err == nil {
|
||||
log.Info("overwrite privacy.tmpl with local file")
|
||||
templates[strings.TrimPrefix(path, "templates/")] =
|
||||
template.Must(template.Must(base.Clone()).ParseFiles("./var/privacy.tmpl"))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
templates[strings.TrimPrefix(path, "templates/")] = template.Must(template.Must(base.Clone()).ParseFS(templateFiles, path))
|
||||
return nil
|
||||
}); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user