confx

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package confx reads settings from environment variables.

Every problem is collected instead of returned immediately: the application fails with the full list of bad or missing variables rather than one per restart.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

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

Loader reads variables sharing a prefix and accumulates errors.

func New

func New(prefix string) *Loader

New creates a loader. The prefix may be empty.

func (*Loader) Bool

func (l *Loader) Bool(name string, def bool) bool

Bool reads true or false.

func (*Loader) Duration

func (l *Loader) Duration(name string, def time.Duration) time.Duration

Duration reads a Go duration such as 30s or 5m.

func (*Loader) Err

func (l *Loader) Err() error

Err returns every collected error as one.

func (*Loader) Fail added in v0.2.0

func (l *Loader) Fail(err error)

Fail records a problem found while interpreting a variable, such as a list with a bad entry, so it is reported together with the rest.

func (*Loader) Int

func (l *Loader) Int(name string, def int) int

Int reads an integer.

func (*Loader) Key

func (l *Loader) Key(name string) string

Key returns the full variable name including the prefix.

func (*Loader) Required

func (l *Loader) Required(name string) string

Required returns the value and records an error when the variable is unset.

func (*Loader) String

func (l *Loader) String(name, def string) string

String returns the value or def when the variable is unset.

func (*Loader) Strings

func (l *Loader) Strings(name string, def []string) []string

Strings reads a comma separated list.

Jump to

Keyboard shortcuts

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