Documentation
¶
Index ¶
Constants ¶
const SecretDefaultRE = "(key)|(secret)|(pass)|(password)|(cert)|(certificate)"
SecretDefaultRE is the default regular expression used to identify secret values automatically.
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.
Functions ¶
This section is empty.
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 (*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 (e.g. `"secrets": [ "a", "b", "c"]`) containing secrets, are replaced with a single *.