Documentation ¶
Index ¶
Constants ¶
View Source
const ( EnvDevelopment = "development" EnvTest = "test" EnvKey = "ENV" )
View Source
const (
TagKey = "env"
)
Variables ¶
View Source
var ( // A field is marked as required, but the environment variable of that key is not defined ErrRequiredKeyUndefined = errors.New("required key is not defined") // The map entry is not specified in the correct format, expects "key:value" ErrInvalidMapEntry = errors.New("invalid map entry") ErrInvalidTarget = errors.New("target must be a struct pointer") ErrUnsupportedType = errors.New("unsupported data type") )
View Source
var EnvMask = []string{
"password",
"passcode",
"secret",
"passphrase",
"privkey",
"privatekey",
"private_key",
"mongo_uri",
"access_token",
"api_key",
}
Functions ¶
func LoadDotEnv ¶
func LoadDotEnv(environment ...*Environment) error
Types ¶
type Environment ¶
func NewEnvironment ¶
func NewEnvironment(option ...*Option) *Environment
func Parse ¶
func Parse(obj interface{}, option ...*Option) (*Environment, error)
Parse studies the model of obj, and reads environment variables into its fields.
type ParseError ¶
type ParseError struct { KeyName string FieldName string TypeName string Value string Reason error }
ParseError occurs during the parsing of a specific struct field. It contains detail about that field, and the reason for the error.
func (*ParseError) Error ¶
func (err *ParseError) Error() string
func (*ParseError) Unwrap ¶
func (err *ParseError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.