Documentation
¶
Index ¶
Constants ¶
const SecretDefaultRE = "(key)|(secret)|(pass)|(password)|(cert)|(certificate)"
SecretDefaultRE is the default regular expression used to identify secret values automatically. All input to the regular expression is preprocessed using the strings.ToLower function, to not unnecessarily complicate the regexp.
Variables ¶
var SecretRE = regexp.MustCompile(SecretDefaultRE)
SecretRE is the regular expression used to identify secret values automatically. In case there are different properties to identify secrets, extend it.
var TemplateFunctions = template.FuncMap{
"arg": argumentValue,
"hasArg": argumentPresent,
"required": required,
"read": readFile,
}
TemplateFunctions is a template.FuncMap that allows to globally remove the additional templig template functions or even add own functions on top of what is already provided. For user provided functions, please use the prefix `uP`, that is guaranteed to never be used as a templig provided function.
Functions ¶
func HideSecrets ¶ added in v0.4.0
HideSecrets hides secrets in the given YAML node structure. Secrets are identified using the SecretRE. Depending on the parameter `hideStructure` the structure of the secret is hidden too (`true`) or visible (`false`).
Types ¶
type Config ¶
type Config[T any] struct { // contains filtered or unexported fields }
Config is the generic structure holding the configuration information for the specified type.
func FromFile ¶
FromFile loads a series of configuration files. The first file is considered the base, all others are loaded on top of that one using the MergeYAMLNodes functionality.
func FromFiles
deprecated
added in
v0.3.0
FromFiles loads a series of configuration files. The first file is considered the base, all others are loaded on top of that one using the MergeYAMLNodes functionality.
Deprecated: As of version 0.6.0 this function is deprecated and will be removed in the next major release.
func (*Config[T]) Get ¶
func (c *Config[T]) Get() *T
Get gives a pointer to the deserialized configuration.
func (*Config[T]) ToFile ¶
ToFile saves a configuration to a file with the given name, replacing it in case.
func (*Config[T]) ToSecretsHidden ¶
ToSecretsHidden writes the configuration to the given io.Writer and hides secret values using the SecretRE. Strings are replaced with the number of * corresponding to their length. Substructures containing secrets, are replaced with a single '*'. The following example
id: id0 secrets: - secret0 - secret1
thus will be replaced by
id: id0 secrets: *
func (*Config[T]) ToSecretsHiddenStructured ¶ added in v0.4.0
ToSecretsHiddenStructured writes the configuration to the given io.Writer and hides secret values using the SecretRE. Strings are replaced with the number of * corresponding to their length. Substructures containing secrets, are replaced with a corresponding structure of '*'. The following example
id: id0 secrets: - secret0 - secret1
thus will be replaced by
id: id0 secrets: - ******* - *******
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
overlay
command
|
|
|
simple
command
|
|
|
templating/arg
command
|
|
|
templating/env
command
|
|
|
templating/hasArg
command
|
|
|
templating/read
command
|
|
|
validate
command
|