template

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName string = "template"

PluginName contains the name/id of the plugin.

Variables

This section is empty.

Functions

func Metadata

func Metadata(settings api.Settings) map[string]interface{}

Metadata passed to nginx-wrapper initialization.

func Start

func Start(context api.PluginStartupContext) error

Start is invoked by nginx-wrapper to start the plugin.

Types

type PathObject

type PathObject struct {
	Name  string
	IsDir bool
}

PathObject represents an object on the file system - either a directory or a file.

func (PathObject) String

func (po PathObject) String() string

type ProcessingError

type ProcessingError struct {
	Message              string
	TemplateFile         string
	OutputFile           string
	TemplateName         string
	IsATemplatingProblem bool
	Err                  error
}

ProcessingError is an error that occurs when templates are being applied to nginx configuration.

func (*ProcessingError) Cause

func (e *ProcessingError) Cause() error

Cause returns the cause of the error - the same as the Unwrap() method.

func (*ProcessingError) Error

func (e *ProcessingError) Error() string

func (*ProcessingError) Unwrap

func (e *ProcessingError) Unwrap() error

type Template

type Template struct {
	// map of all template files as keys and output files as values
	Files                 *orderedmap.OrderedMap
	TemplateFileSuffix    string
	ConfTemplatePath      string
	ConfOutputPath        string
	TemplateVarLeftDelim  string
	TemplateVarRightDelim string
}

Template represents a set of files/directories that will be templated or copied.

func NewTemplate

func NewTemplate(settings api.Settings) Template

NewTemplate creates a new instance of a Template.

func (*Template) ApplyTemplating

func (t *Template) ApplyTemplating(settings api.Settings) *ProcessingError

ApplyTemplating runs all templates and performs substitutions using the supplied Viper config instance as a data source.

func (*Template) CleanOutputConfiguration

func (t *Template) CleanOutputConfiguration() []error

CleanOutputConfiguration removes the configuration that was already templatized.

func (*Template) DiscoverTemplateFiles

func (t *Template) DiscoverTemplateFiles() error

DiscoverTemplateFiles finds all of the template files within the conf_template_path.

Jump to

Keyboard shortcuts

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