Documentation
¶
Index ¶
- Variables
- func CheckDisallowed(prefix string, spec interface{}) error
- func MustProcess(prefix string, spec interface{})
- func Process(prefix string, spec interface{}) error
- func ProcessWithReader(prefix string, spec interface{}, reader Reader) error
- type Decoder
- type ParseError
- type Reader
- type ReaderFunc
- type Setter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EnvironmentReader = ReaderFunc(func(key string) (string, bool, error) { v, ok := os.LookupEnv(key) return v, ok, nil }) )
View Source
var ErrInvalidSpecification = errors.New("specification must be a struct pointer")
ErrInvalidSpecification indicates that a specification is of the wrong type.
Functions ¶
func CheckDisallowed ¶
CheckDisallowed checks that no environment variables with the prefix are set that we don't know how or want to parse. This is likely only meaningful with a non-empty prefix.
func MustProcess ¶
func MustProcess(prefix string, spec interface{})
MustProcess is the same as Process but panics if an error occurs
func ProcessWithReader ¶ added in v1.0.0
Types ¶
type Decoder ¶
Decoder has the same semantics as Setter, but takes higher precedence. It is provided for historical compatibility.
type ParseError ¶
A ParseError occurs when an environment variable cannot be converted to the type required by a struct field during assignment.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type ReaderFunc ¶ added in v1.0.0
Click to show internal directories.
Click to hide internal directories.