config

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMarker = "__default__"

Variables

View Source
var ErrConfigNotLoaded = errors.New("config not loaded")

Functions

func Get

func Get(key string, out any) error

Get populates out with the configuration at the given key. Populate out with default values before calling this function to ensure sane defaults if there are any.

func GetSection

func GetSection(section Section) error

GetSection populates a config section.

func Load

func Load(confFile string, overrides map[string]any) error

Load loads the config file at the given path.

func LoadMap

func LoadMap(m map[string]any) error

func LoadReader

func LoadReader(reader io.Reader, overrides map[string]any) error

Types

type Defaulter

type Defaulter interface {
	SetDefaults()
}

type Section

type Section interface {
	Key() string
}

type Validator

type Validator interface {
	Validate() error
}

type Wrapper added in v0.15.0

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

func Global added in v0.15.0

func Global() *Wrapper

Global returns the default global config wrapper.

func WrapperFromMap added in v0.15.0

func WrapperFromMap(m map[string]any) (*Wrapper, error)

func WrapperFromReader added in v0.15.0

func WrapperFromReader(reader io.Reader, overrides map[string]any) (*Wrapper, error)

func (*Wrapper) Get added in v0.15.0

func (w *Wrapper) Get(key string, out any) error

func (*Wrapper) GetSection added in v0.15.0

func (w *Wrapper) GetSection(section Section) error

Jump to

Keyboard shortcuts

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