mirror of
https://github.com/Luzifer/ots.git
synced 2025-08-01 18:56:04 -04:00
This commit is contained in:
parent
6fdf184357
commit
f4d16e912c
14 changed files with 377 additions and 28 deletions
12
tplFuncs.go
12
tplFuncs.go
|
@ -5,16 +5,20 @@ import (
|
|||
"encoding/base64"
|
||||
"sync"
|
||||
"text/template"
|
||||
|
||||
"github.com/Masterminds/sprig/v3"
|
||||
)
|
||||
|
||||
var (
|
||||
sriCacheStore = newSRICache()
|
||||
tplFuncs = template.FuncMap{
|
||||
"list": func(args ...string) []string { return args },
|
||||
"assetSRI": assetSRIHash,
|
||||
}
|
||||
tplFuncs template.FuncMap
|
||||
)
|
||||
|
||||
func init() {
|
||||
tplFuncs = sprig.FuncMap()
|
||||
tplFuncs["assetSRI"] = assetSRIHash
|
||||
}
|
||||
|
||||
func assetSRIHash(assetName string) string {
|
||||
if sri, ok := sriCacheStore.Get(assetName); ok {
|
||||
return sri
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue