-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathassets.go
39 lines (32 loc) · 815 Bytes
/
assets.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"embed"
"path"
"text/template"
"traefik-lazyload/pkg/config"
"traefik-lazyload/pkg/containers"
"traefik-lazyload/pkg/service"
)
//go:embed assets/*
var httpAssets embed.FS
const httpAssetPrefix = "/__llassets/"
type SplashModel struct {
*service.ContainerState
Hostname string
}
type StatusPageModel struct {
Active []*service.ContainerState
Qualifying []containers.Wrapper
Providers []containers.Wrapper
RuntimeMetrics string
}
type assetTemplates struct {
splash *template.Template
status *template.Template
}
func LoadTemplates() *assetTemplates {
return &assetTemplates{
splash: template.Must(template.ParseFS(httpAssets, path.Join("assets", config.Model.Splash))),
status: template.Must(template.ParseFS(httpAssets, "assets/status.html")),
}
}