base64 k8s (yaml) decoder expects padding
This commit is contained in:
@ -26,14 +26,10 @@ import (
|
||||
|
||||
"novit.tech/direktil/pkg/config"
|
||||
"novit.tech/direktil/pkg/localconfig"
|
||||
|
||||
bsconfig "novit.tech/direktil/pkg/bootstrapconfig"
|
||||
)
|
||||
|
||||
var cmdlineParam = restful.QueryParameter("cmdline", "Linux kernel cmdline addition")
|
||||
|
||||
var b64 = base64.StdEncoding.WithPadding(base64.NoPadding)
|
||||
|
||||
type renderContext struct {
|
||||
Host *localconfig.Host
|
||||
SSLConfig *cfsslconfig.Config
|
||||
@ -114,19 +110,8 @@ func (ctx *renderContext) Config() (ba []byte, cfg *config.Config, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (ctx *renderContext) BootstrapConfig() (ba []byte, cfg *bsconfig.Config, err error) {
|
||||
ba, err = ctx.render(ctx.Host.BootstrapConfig)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
cfg = &bsconfig.Config{}
|
||||
if err = yaml.Unmarshal(ba, cfg); err != nil {
|
||||
log.Print("invalid bootstrap config yaml:\n", string(ba))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
func (ctx *renderContext) BootstrapConfig() (ba []byte, err error) {
|
||||
return ctx.render(ctx.Host.BootstrapConfig)
|
||||
}
|
||||
|
||||
func (ctx *renderContext) render(templateText string) (ba []byte, err error) {
|
||||
@ -190,7 +175,7 @@ func (ctx *renderContext) TemplateFuncs() map[string]any {
|
||||
|
||||
for name, method := range map[string]any{
|
||||
"base64": func(input string) string {
|
||||
return b64.EncodeToString([]byte(input))
|
||||
return base64.StdEncoding.EncodeToString([]byte(input))
|
||||
},
|
||||
|
||||
"host_ip": func() (s string) {
|
||||
|
||||
Reference in New Issue
Block a user