fix: render template for addons and bootstrap pods
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
"novit.nc/direktil/local-server/pkg/mime"
|
||||
@ -133,3 +134,17 @@ func wsError(resp *restful.Response, err error) {
|
||||
http.StatusInternalServerError,
|
||||
http.StatusText(http.StatusInternalServerError))
|
||||
}
|
||||
|
||||
func wsRender(resp *restful.Response, tmplStr string, value interface{}) {
|
||||
tmpl, err := template.New("wsRender").Funcs(templateFuncs).Parse(tmplStr)
|
||||
if err != nil {
|
||||
wsError(resp, err)
|
||||
return
|
||||
}
|
||||
|
||||
err = tmpl.Execute(resp, value)
|
||||
if err != nil {
|
||||
wsError(resp, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user