tpl

package
v0.20.0 Latest Latest
Warning

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

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

Documentation

Overview

Package tpl provides a way to parse a template string and inject secret values into it.

Index

Constants

View Source
const (
	// DefaultStartDelimiter defines the characters a template block starts with.
	DefaultStartDelimiter = "${"
	// DefaultEndDelimiter defines the characters a template block ends with.
	DefaultEndDelimiter = "}"
	// DefaultTrimChars defines the cutset of characters that will be trimmed from template blocks.
	DefaultTrimChars = " "
)

Variables

View Source
var (
	ErrParseFailed    = errInject.Code("parse_failed").ErrorPref("failed to parse contents: %v")
	ErrSecretNotFound = errInject.Code("secret_not_found").ErrorPref("no secret found to inject for path %s")
)

Errors

Functions

This section is empty.

Types

type Template

type Template struct {
	Raw     string
	Secrets []api.SecretPath
	// contains filtered or unexported fields
}

Template helps with injecting values into strings that contain the template syntax.

func New

func New(raw string) (*Template, error)

New creates a new template and parses it.

func (*Template) Inject

func (t *Template) Inject(secrets map[api.SecretPath][]byte) (string, error)

Inject inserts the given secrets at their corresponding places in the raw template and returns the injected template.

Jump to

Keyboard shortcuts

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