config

package
v0.0.0-...-54d739a Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(set *pflag.FlagSet)

AddFlags adds the flags related to configuration to the given flag set.

Types

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader contains the data and logic needed to load a configuration object. Don't create instances of this type directly, use the NewLoader function instead.

func NewLoader

func NewLoader() *Loader

NewLoader creates a builder that can then be used to create a new configuration object.

func (*Loader) Load

func (l *Loader) Load() (result *models.Config, err error)

Load uses the data stored in the loader to create and populate a configuration object.

func (*Loader) SetFlags

func (b *Loader) SetFlags(flags *pflag.FlagSet) *Loader

SetFlags sets the command line flags that that indicate how to load the configuration. This is optional.

func (*Loader) SetLogger

func (l *Loader) SetLogger(value logr.Logger) *Loader

SetLogger sets the logger that the loader will use to write to the log. This is mandatory.

func (*Loader) SetSource

func (l *Loader) SetSource(value any) *Loader

SetSource sets the source for the configuration. It can be one of the following things:

- A string ending in `.yaml` or .`yml`. In this case it will be interpreted as the name of a YAML file containing the configuration.

- A string not ending in `.yaml`, `.yml`. In this case it will be interpredted as the content of the configuration itself.

- An array of bytes containing the configuration as an UTF-8 string.

- A io.Reader providing the configuration text.

This is mandatory.

Jump to

Keyboard shortcuts

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