diff --git a/cmd/dkl-dir2config/main.go b/cmd/dkl-dir2config/main.go index eb377d3..41665d0 100644 --- a/cmd/dkl-dir2config/main.go +++ b/cmd/dkl-dir2config/main.go @@ -16,6 +16,8 @@ import ( "novit.tech/direktil/local-server/pkg/clustersconfig" ) +var Version = "dev" + var ( Debug = false diff --git a/cmd/dkl-dir2config/render-context.go b/cmd/dkl-dir2config/render-context.go index 5da29cf..a0bb646 100644 --- a/cmd/dkl-dir2config/render-context.go +++ b/cmd/dkl-dir2config/render-context.go @@ -185,6 +185,8 @@ func (ctx *renderContext) renderConfigTo(buf io.Writer, configTemplate *clusters return hex.EncodeToString(ba[:]) } + extraFuncs["version"] = func() string { return Version } + if err := configTemplate.Execute(ctxName, "config", buf, ctxMap, extraFuncs); err != nil { log.Fatalf("failed to render config %q for host %q: %v", ctx.Host.Config, ctx.Host.Name, err) }