config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//nolint:gochecknoglobals
	NoSchema = &gojsonschema.Schema{}

	ErrNoRegisteredName   = errors.New("could not find a config entry with that name")
	ErrEnvVarRef          = errors.New("could not find an environment variable")
	ErrPathVarRef         = errors.New("could not find path variable")
	ErrPathVarRefCircular = errors.New("circular path reference detected")
	ErrMalformedPathRef   = errors.New("malformed path reference")
	ErrMalformedEnvRef    = errors.New("malformed env reference")
	ErrUnmarshal          = errors.New("failed to decode configuration")
	ErrSubmatchEnv        = errors.New("failed to find submatch in env match")
	ErrSchema             = errors.New("schema validation failed")
)

Functions

func AccessAs

func AccessAs[T any](cfg Map, name string) T

AccessAs accesses a configuration entry by name and casts it to the provided type T. It panics if the config entry is not found or if the type assertion fails.

Types

type Config

type Config interface {
	Schema() *gojsonschema.Schema
}

type Map

type Map interface {
	Register(name string, cfg Config)
	Load(name string, data []byte) error
	MustLoad(name string, data []byte)
	Parse() error
	Access(name string) (Config, error)
}

func New

func New() Map

Jump to

Keyboard shortcuts

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