mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-27 05:49:04 +01:00
feat - Allow to overwrite login template
This commit is contained in:
parent
fc33bfb47b
commit
eb867528e3
@ -325,6 +325,13 @@ func main() {
|
|||||||
|
|
||||||
if config.Keys.EmbedStaticFiles {
|
if config.Keys.EmbedStaticFiles {
|
||||||
r.PathPrefix("/").Handler(web.ServeFiles())
|
r.PathPrefix("/").Handler(web.ServeFiles())
|
||||||
|
|
||||||
|
if i, err := os.Stat("./var/img"); err == nil {
|
||||||
|
if i.IsDir() {
|
||||||
|
log.Info("Use local directory for static images")
|
||||||
|
r.Handle("/img", http.FileServer(http.Dir("./var/img")))
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
r.PathPrefix("/").Handler(http.FileServer(http.Dir(config.Keys.StaticFiles)))
|
r.PathPrefix("/").Handler(http.FileServer(http.Dir(config.Keys.StaticFiles)))
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,14 @@ func init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if path == "templates/login.tmpl" {
|
||||||
|
if _, err := os.Stat("./var/login.tmpl"); err == nil {
|
||||||
|
log.Info("overwrite login.tmpl with local file")
|
||||||
|
templates[strings.TrimPrefix(path, "templates/")] =
|
||||||
|
template.Must(template.Must(base.Clone()).ParseFiles("./var/login.tmpl"))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
if path == "templates/imprint.tmpl" {
|
if path == "templates/imprint.tmpl" {
|
||||||
if _, err := os.Stat("./var/imprint.tmpl"); err == nil {
|
if _, err := os.Stat("./var/imprint.tmpl"); err == nil {
|
||||||
log.Info("overwrite imprint.tmpl with local file")
|
log.Info("overwrite imprint.tmpl with local file")
|
||||||
|
Loading…
Reference in New Issue
Block a user