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 CheckDisallowed(prefix string, spec interface{}) error
- func CheckDisallowedWithOptions(prefix string, spec interface{}, options Options) error
- func MustProcess(prefix string, spec interface{})
- func MustProcessWithOptions(prefix string, spec interface{}, options Options)
- func Process(prefix string, spec interface{}) error
- func ProcessWithOptions(prefix string, spec interface{}, options Options) error
- func Usage(prefix string, spec interface{}) error
- func UsageWithOptions(prefix string, spec interface{}, options Options) error
- func Usagef(prefix string, spec interface{}, out io.Writer, format string) error
- func UsagefWithOptions(prefix string, spec interface{}, out io.Writer, format string, options Options) error
- func Usaget(prefix string, spec interface{}, out io.Writer, tmpl *template.Template) error
- func UsagetWithOptions(prefix string, spec interface{}, out io.Writer, tmpl *template.Template, ...) error
- type Decoder
- type Options
- type ParseError
- type Setter
Constants ¶
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 ¶
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 CheckDisallowedWithOptions ¶
CheckDisallowedWithOptions is like CheckDisallowed() but with specified options.
func MustProcess ¶
func MustProcess(prefix string, spec interface{})
MustProcess is the same as Process but panics if an error occurs
func MustProcessWithOptions ¶
MustProcessWithOptions is like MustProcess() but with specified options.
func ProcessWithOptions ¶
ProcessWithOptions is like Process() but with specified options.
func UsageWithOptions ¶
UsageWithOptions is like Usage() but with specified options.
func Usagef ¶
Usagef writes usage information to the specified io.Writer using the specified template specification
func UsagefWithOptions ¶
func UsagefWithOptions(prefix string, spec interface{}, out io.Writer, format string, options Options) error
UsagefWithOptions is like Usagef() but with specified options.
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