Documentation
¶
Overview ¶
Package envconfig implements decoding of environment variables based on a user defined specification. A typical use is using environment variables for configuration settings.
Index ¶
- Constants
- Variables
- func MustProcess(prefixes []string, spec interface{}, delim string)
- func Process(prefixes []string, spec interface{}, delim string) error
- func Usage(prefixes []string, spec interface{}, delim string) error
- func Usagef(prefixes []string, spec interface{}, out io.Writer, format string, ...) error
- func Usaget(prefixes []string, spec interface{}, out io.Writer, tmpl *template.Template, ...) error
- type Decoder
- type ParseError
- type Setter
Constants ¶
View Source
const ( // DefaultListFormat constant to use to display usage in a list format DefaultListFormat = `` /* 282-byte string literal not displayed */ // DefaultTableFormat constant to use to display usage in a tabular format DefaultTableFormat = `` /* 256-byte string literal not displayed */ )
Variables ¶
View Source
var ErrInvalidSpecification = errors.New("specification must be a struct pointer")
ErrInvalidSpecification indicates that a specification is of the wrong type.
Functions ¶
func MustProcess ¶ added in v1.1.0
MustProcess is the same as Process but panics if an error occurs
func Usage ¶ added in v1.3.0
Usage writes usage information to stderr using the default header and table format
Types ¶
type Decoder ¶ added in v1.2.0
Decoder has the same semantics as Setter, but takes higher precedence. It is provided for historical compatibility.
type ParseError ¶
type ParseError struct { KeyName string KeyNames []string FieldName string TypeName string Value string Err error }
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
Click to show internal directories.
Click to hide internal directories.