diff --git a/internal/controllers/applications.go b/internal/controllers/applications.go index 0badae7..2843eeb 100644 --- a/internal/controllers/applications.go +++ b/internal/controllers/applications.go @@ -1,11 +1,13 @@ package controllers import ( + "bytes" "context" b64 "encoding/base64" "fmt" "os" "strings" + "text/template" "git.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/helm" "git.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/kube" @@ -109,17 +111,23 @@ func (app *Application) Create(ctx context.Context) error { } if len(app.Data.Config) > 0 { for key, val := range app.Data.Config { - logrus.Info(key) - logrus.Info(val) - logrus.Info(cfgSchema) value, ok := cfgSchema[key] if !ok { return fmt.Errorf("unsuported config entry: %s", key) } + tmpl, err := template.New("prettyconfig").Parse(val) + if err != nil { + panic(err) + } + var tmplRes bytes.Buffer + if err := tmpl.Execute(&tmplRes, tmpl); err != nil { + return err + } + cfg.Config.Pretty = append(cfg.Config.Pretty, helmrelease.PrettyConfig{ Key: key, Path: value.Path, - Value: val, + Value: tmplRes.String(), }) } } else if len(app.Data.RawConfig) > 0 {