Documentation
¶
Index ¶
- Constants
- func EnsureConfigurationExists(path string) (created bool, err error)
- func IsSecretKey(key string) (isSecretKey bool)
- func Load(val *schema.StructValidator, sources ...Source) (keys []string, configuration *schema.Configuration, err error)
- func LoadAdvanced(val *schema.StructValidator, path string, result any, sources ...Source) (keys []string, err error)
- func StringToAddressHookFunc() mapstructure.DecodeHookFuncType
- func StringToCryptoPrivateKeyHookFunc() mapstructure.DecodeHookFuncType
- func StringToMailAddressHookFunc() mapstructure.DecodeHookFuncType
- func StringToPasswordDigestHookFunc() mapstructure.DecodeHookFuncType
- func StringToPrivateKeyHookFunc() mapstructure.DecodeHookFuncType
- func StringToRegexpHookFunc() mapstructure.DecodeHookFuncType
- func StringToTLSVersionHookFunc() mapstructure.DecodeHookFuncType
- func StringToURLHookFunc() mapstructure.DecodeHookFuncType
- func StringToX509CertificateChainHookFunc() mapstructure.DecodeHookFuncType
- func StringToX509CertificateHookFunc() mapstructure.DecodeHookFuncType
- func ToEnvironmentKey(key, prefix, delimiter string) string
- func ToEnvironmentSecretKey(key, prefix, delimiter string) string
- func ToTimeDurationHookFunc() mapstructure.DecodeHookFuncType
- type CommandLineSource
- type Deprecation
- type EnvironmentSource
- type MapSource
- type SecretsSource
- type Source
- type YAMLFileSource
Constants ¶
const DefaultEnvDelimiter = "_"
DefaultEnvDelimiter is the default environment delimiter.
const DefaultEnvPrefix = "AUTHELIA_"
DefaultEnvPrefix is the default environment prefix.
Variables ¶
This section is empty.
Functions ¶
func EnsureConfigurationExists ¶
EnsureConfigurationExists is an auxiliary function to the main Configuration tools that ensures the Configuration template is created if it doesn't already exist.
func IsSecretKey ¶ added in v4.36.8
IsSecretKey returns true if the provided key is a secret enabled key.
func Load ¶
func Load(val *schema.StructValidator, sources ...Source) (keys []string, configuration *schema.Configuration, err error)
Load the configuration given the provided options and sources.
func LoadAdvanced ¶ added in v4.33.0
func LoadAdvanced(val *schema.StructValidator, path string, result any, sources ...Source) (keys []string, err error)
LoadAdvanced is intended to give more flexibility over loading a particular path to a specific interface.
func StringToAddressHookFunc ¶ added in v4.36.0
func StringToAddressHookFunc() mapstructure.DecodeHookFuncType
StringToAddressHookFunc decodes a string into an Address or *Address.
func StringToCryptoPrivateKeyHookFunc ¶ added in v4.37.0
func StringToCryptoPrivateKeyHookFunc() mapstructure.DecodeHookFuncType
StringToCryptoPrivateKeyHookFunc decodes strings to schema.CryptographicPrivateKey's.
func StringToMailAddressHookFunc ¶ added in v4.34.5
func StringToMailAddressHookFunc() mapstructure.DecodeHookFuncType
StringToMailAddressHookFunc decodes a string into a mail.Address or *mail.Address.
func StringToPasswordDigestHookFunc ¶ added in v4.37.0
func StringToPasswordDigestHookFunc() mapstructure.DecodeHookFuncType
StringToPasswordDigestHookFunc decodes a string into a crypt.Digest.
func StringToPrivateKeyHookFunc ¶ added in v4.37.0
func StringToPrivateKeyHookFunc() mapstructure.DecodeHookFuncType
StringToPrivateKeyHookFunc decodes strings to rsa.PrivateKey's.
func StringToRegexpHookFunc ¶ added in v4.36.0
func StringToRegexpHookFunc() mapstructure.DecodeHookFuncType
StringToRegexpHookFunc decodes a string into a *regexp.Regexp or regexp.Regexp.
func StringToTLSVersionHookFunc ¶ added in v4.37.0
func StringToTLSVersionHookFunc() mapstructure.DecodeHookFuncType
StringToTLSVersionHookFunc decodes strings to schema.TLSVersion's.
func StringToURLHookFunc ¶ added in v4.34.5
func StringToURLHookFunc() mapstructure.DecodeHookFuncType
StringToURLHookFunc converts string types into a url.URL or *url.URL.
func StringToX509CertificateChainHookFunc ¶ added in v4.37.0
func StringToX509CertificateChainHookFunc() mapstructure.DecodeHookFuncType
StringToX509CertificateChainHookFunc decodes strings to schema.X509CertificateChain's.
func StringToX509CertificateHookFunc ¶ added in v4.37.0
func StringToX509CertificateHookFunc() mapstructure.DecodeHookFuncType
StringToX509CertificateHookFunc decodes strings to x509.Certificate's.
func ToEnvironmentKey ¶ added in v4.36.8
ToEnvironmentKey converts a key into the environment variable name.
func ToEnvironmentSecretKey ¶ added in v4.36.8
ToEnvironmentSecretKey converts a key into the environment variable name.
func ToTimeDurationHookFunc ¶ added in v4.34.5
func ToTimeDurationHookFunc() mapstructure.DecodeHookFuncType
ToTimeDurationHookFunc converts string and integer types to a time.Duration.
Types ¶
type CommandLineSource ¶ added in v4.33.0
type CommandLineSource struct {
// contains filtered or unexported fields
}
CommandLineSource loads configuration from the command line flags.
func NewCommandLineSourceWithMapping ¶ added in v4.33.0
func NewCommandLineSourceWithMapping(flags *pflag.FlagSet, mapping map[string]string, includeValidKeys, includeUnchangedKeys bool) (source *CommandLineSource)
NewCommandLineSourceWithMapping creates a new command line configuration source with a map[string]string which converts flag names into other config key names. If includeValidKeys is true we also allow any flag with a name which matches the list of valid keys into the koanf.Koanf, otherwise everything not in the map is skipped. Unchanged flags are also skipped unless includeUnchangedKeys is set to true.
func (*CommandLineSource) Load ¶ added in v4.33.0
func (s *CommandLineSource) Load(_ *schema.StructValidator) (err error)
Load the Source into the YAMLFileSource koanf.Koanf.
func (*CommandLineSource) Merge ¶ added in v4.33.0
func (s *CommandLineSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error)
Merge the CommandLineSource koanf.Koanf into the provided one.
func (*CommandLineSource) Name ¶ added in v4.33.0
func (s *CommandLineSource) Name() (name string)
Name of the Source.
type Deprecation ¶ added in v4.36.0
type Deprecation struct { Version model.SemanticVersion Key string NewKey string AutoMap bool MapFunc func(value any) any ErrText string }
Deprecation represents a deprecated configuration key.
type EnvironmentSource ¶
type EnvironmentSource struct {
// contains filtered or unexported fields
}
EnvironmentSource is a configuration Source which loads values from the environment.
func NewEnvironmentSource ¶
func NewEnvironmentSource(prefix, delimiter string) (source *EnvironmentSource)
NewEnvironmentSource returns a Source configured to load from environment variables.
func (*EnvironmentSource) Load ¶
func (s *EnvironmentSource) Load(_ *schema.StructValidator) (err error)
Load the Source into the EnvironmentSource koanf.Koanf.
func (*EnvironmentSource) Merge ¶
func (s *EnvironmentSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error)
Merge the EnvironmentSource koanf.Koanf into the provided one.
func (*EnvironmentSource) Name ¶
func (s *EnvironmentSource) Name() (name string)
Name of the Source.
type MapSource ¶ added in v4.36.0
type MapSource struct {
// contains filtered or unexported fields
}
MapSource loads configuration from the command line flags.
func NewMapSource ¶ added in v4.36.0
NewMapSource returns a new map[string]any source.
func (*MapSource) Load ¶ added in v4.36.0
func (s *MapSource) Load(_ *schema.StructValidator) (err error)
Load the Source into the YAMLFileSource koanf.Koanf.
type SecretsSource ¶
type SecretsSource struct {
// contains filtered or unexported fields
}
SecretsSource loads environment variables that have a value pointing to a file.
func NewSecretsSource ¶
func NewSecretsSource(prefix, delimiter string) (source *SecretsSource)
NewSecretsSource returns a Source configured to load from secrets.
func (*SecretsSource) Load ¶
func (s *SecretsSource) Load(val *schema.StructValidator) (err error)
Load the Source into the SecretsSource koanf.Koanf.
func (*SecretsSource) Merge ¶
func (s *SecretsSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error)
Merge the SecretsSource koanf.Koanf into the provided one.
type Source ¶
type Source interface { Name() (name string) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) Load(val *schema.StructValidator) (err error) }
Source is an abstract representation of a configuration Source implementation.
func NewDefaultSources ¶
func NewDefaultSources(filePaths []string, prefix, delimiter string, additionalSources ...Source) (sources []Source)
NewDefaultSources returns a slice of Source configured to load from specified YAML files.
func NewDefaultSourcesWithDefaults ¶ added in v4.36.0
func NewDefaultSourcesWithDefaults(filePaths []string, prefix, delimiter string, defaults Source, additionalSources ...Source) (sources []Source)
NewDefaultSourcesWithDefaults returns a slice of Source configured to load from specified YAML files with additional sources.
type YAMLFileSource ¶
type YAMLFileSource struct {
// contains filtered or unexported fields
}
YAMLFileSource is a configuration Source with a YAML File.
func NewYAMLFileSource ¶
func NewYAMLFileSource(path string) (source *YAMLFileSource)
NewYAMLFileSource returns a Source configured to load from a specified YAML path. If there is an issue accessing this path it also returns an error.
func NewYAMLFileSources ¶
func NewYAMLFileSources(paths []string) (sources []*YAMLFileSource)
NewYAMLFileSources returns a slice of Source configured to load from specified YAML files.
func (*YAMLFileSource) Load ¶
func (s *YAMLFileSource) Load(_ *schema.StructValidator) (err error)
Load the Source into the YAMLFileSource koanf.Koanf.
func (*YAMLFileSource) Merge ¶
func (s *YAMLFileSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error)
Merge the YAMLFileSource koanf.Koanf into the provided one.