Documentation ¶
Index ¶
- Constants
- func EnsureConfigurationExists(path string) (created bool, err error)
- func Load(val *schema.StructValidator, sources ...Source) (keys []string, configuration *schema.Configuration, err error)
- func LoadAdvanced(val *schema.StructValidator, path string, result interface{}, ...) (keys []string, err error)
- func StringToMailAddressFunc() mapstructure.DecodeHookFunc
- type CommandLineSource
- type EnvironmentSource
- 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 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 interface{}, sources ...Source) (keys []string, err error)
LoadAdvanced is intended to give more flexibility over loading a particular path to a specific interface.
func StringToMailAddressFunc ¶ added in v4.33.0
func StringToMailAddressFunc() mapstructure.DecodeHookFunc
StringToMailAddressFunc decodes a string into a mail.Address.
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 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.
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 ¶
NewDefaultSources returns a slice of Source configured to load from specified YAML files.
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.