Discover Packages
github.com/snippet-bank/snippets
environment-variables
validate-environment-variables
package
Version:
v0.0.0-...-8920fff
Opens a new window with list of versions in this module.
Published: Feb 23, 2020
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
Retrieving the values of environment variables and validating them is a common problem.
github.com/kelseyhightower/envconfig
provides an easy and structured way of doing both of that.
It allows you to provide a configuration struct in which you can set:
expected names of the variables
expected types of values (e.g. int
or []string
)
whether a variable is required
More information available at godoc .
Expand ▾
Collapse ▴
Documentation
¶
type Specification struct {
Regular string
Array []int
Map map[string ]int
SplitWithUnderscores int `split_words:"true"`
WithDefaultValue int `default:"42"`
OverriddenName int `envconfig:"MANUAL_OVERRIDE"`
Required int `required:"true"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.