Documentation
¶
Overview ¶
Package config provides functions which can be used to extract environment variables and parse them to the right type.
Index ¶
- Constants
- type Parser
- func (c Parser) EnvBool(key string, defaultValue bool) bool
- func (c Parser) EnvFloat(key string, defaultValue float64) float64
- func (c Parser) EnvInt(key string, defaultValue int) int
- func (c Parser) EnvStr(key string, defaultValue string) string
- func (c Parser) EnvStrArray(key string, defaultValue []string) []string
Constants ¶
View Source
const ( // ProdEnv can be used as value when reading out the type of environment. ProdEnv string = "production" // TestEnv can be used as value when reading out the type of environment. TestEnv string = "test" // DevEnv can be used as value when reading out the type of environment. DevEnv string = "development" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶ added in v0.1.9
type Parser struct {
// contains filtered or unexported fields
}
Parser parses the config provided through environment variables.
func New ¶ added in v0.1.9
New returns a new Parser and loads environment variables that could be provided using a .env file (particularly useful during development).
Click to show internal directories.
Click to hide internal directories.