template

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package template implements functions to render Go templates to files using the node.Node struct as an imnput for the templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFileAbsent

func ConfigFileAbsent(filename string, node node.Node) error

ConfigFileAbsent deletes a file if it exists

func ConfigFileRendered

func ConfigFileRendered(filepath, templateContent string, templateData TemplateData) error

ConfigFileRendered renders a template with node confguration and writes it to disk if it doesn't exist yet

In order to allow comma separated lists in the template it defines the template function `notLast` which can be used like this:

{{range $index, $id:= .Config.core.quorum_set_ids -}}
"${{ $id }}"{{if notLast $index $.Config.core.quorum_set_ids}},{{end}}
{{end -}}

func ConfigFilesRendered

func ConfigFilesRendered(filenamesAndTemplates map[string]string, templateData TemplateData) error

ConfigFilesRendered renderes multiple templates to files

Types

type TemplateData

type TemplateData struct {
	Node       node.Node
	PluginData map[string]interface{}
}

TemplateData wraps the data send to the rendering engine

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL