template

package
v0.15.6 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(secret data.SecretStored) (string, error)

Parse takes a data.SecretStored type as input and returns the parsed string or an error.

If the Meta.Template field is empty, it tries to parse secret.Value; otherwise it transforms secret.Value using the Go template transformation defined by Meta.Template.

If the Meta.Format field is None, it returns the parsed string.

If the Meta.Format field is Json, it returns the parsed string if it’s a valid JSON or the original string otherwise.

If the Meta.Format field is Yaml, it tries its best to transform the data into Yaml. If it fails, it tries to return a valid JSON at least. If that fails too, returns the original secret value.

If the Meta.Format field is not recognized, it returns an empty string.

func ParseForK8sSecret

func ParseForK8sSecret(secret data.SecretStored) (map[string]string, error)

ParseForK8sSecret parses the provided `SecretStored` and applies a template if one is defined.

Args:

secret: A SecretStored struct containing the secret data and metadata.

Returns:

A map of string keys to string values, containing the parsed secret data.

If there is an error during parsing or applying the template, an error
will be returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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