envconf

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package envconf provides simple functionality for reading configuration from the environment, such as for use within a 12-Factor Application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// Prefix, when set, is stripped from the beginning of environment
	// variables. This value is case-sensitive.
	Prefix string

	// TagName is the struct tag name used to read envconf metadata from
	// struct fields. Defaults to 'conf'.
	TagName string
}

Decoder is a configured configuration decoder.

func (*Decoder) ReadConfig

func (d *Decoder) ReadConfig(dst interface{}) error

ReadConfig parses the enironment according to the Decoder configuration, and stores the result in dst.

To use default values, set them in dst before calling ReadConfig().

type ParseError

type ParseError struct {
	// Field is the name of the target struct field associated with the error.
	Field string
	// Err is the underlying error
	Err error
}

ParseError represents a parsing error

func (*ParseError) Cause

func (e *ParseError) Cause() error

Cause satisfies the github.com/pkg/errors.causer interface

func (*ParseError) Error

func (e *ParseError) Error() string

Jump to

Keyboard shortcuts

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