render context: add asset_download_token

This commit is contained in:
Mikaël Cluseau
2025-07-27 12:40:01 +02:00
parent d03a7ab4ec
commit f83b1eab23
5 changed files with 85 additions and 65 deletions

View File

@ -8,6 +8,7 @@ import (
"math/rand"
"path"
"reflect"
"strconv"
"strings"
"github.com/cespare/xxhash"
@ -290,6 +291,14 @@ func (ctx *renderContext) templateFuncs(ctxMap map[string]any) map[string]any {
"host_download_token": func() (s string) {
return "{{ host_download_token }}"
},
"asset_download_token": func(args ...string) (s string) {
argsStr := new(strings.Builder)
for _, arg := range args {
argsStr.WriteByte(' ')
argsStr.WriteString(strconv.Quote(arg))
}
return "{{ asset_download_token" + argsStr.String() + " }}"
},
"hosts_of_group": func() (hosts []any) {
hosts = make([]any, 0)