configuration

package
v4.33.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEnvDelimiter = "_"

DefaultEnvDelimiter is the default environment delimiter.

View Source
const DefaultEnvPrefix = "AUTHELIA_"

DefaultEnvPrefix is the default environment prefix.

Variables

This section is empty.

Functions

func EnsureConfigurationExists

func EnsureConfigurationExists(path string) (created bool, err error)

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.

func (EnvironmentSource) Name

func (s EnvironmentSource) Name() (name string)

Name of the Source.

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.

func (SecretsSource) Name

func (s SecretsSource) Name() (name string)

Name of the Source.

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) (sources []Source)

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.

func (YAMLFileSource) Name

func (s YAMLFileSource) Name() (name string)

Name of the Source.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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