Documentation
¶
Overview ¶
Package variable exposes utilities for getting configuration from the environment.
Index ¶
- func GetBool(varName string) (bool, bool)
- func GetBytes(varName string) (uint64, bool)
- func GetDuration(varName string) (time.Duration, bool)
- func GetDurationBC(varName string) (time.Duration, bool)
- func GetFloat64(varName string) (float64, bool)
- func GetHTTPTimeouts(envVar string, defaults netutil.HTTPTimeouts) (netutil.HTTPTimeouts, error)
- func GetInt(varName string) (int, bool)
- func GetUint64(varName string) (uint64, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBool ¶
GetBool returns the boolean value of the environmental variable varName if the env var is empty or not a boolean it will return false, false.
func GetBytes ¶
GetBytes returns the number of bytes represented by the environmental variable varName if the env var is empty or not a valid byte string it will return 0, false.
func GetDuration ¶
GetDuration returns the time.Duration value of the environmental variable varName if the env var is empty or not a valid duration string it will return 0, false.
func GetDurationBC ¶
GetDurationBC returns the time.Duration value of the environmental variable varName if the env var is empty or not a valid duration string it will return 0, false.
NOTE: This is the backwards compatible variant of 'GetDuration' meaning when failing to parse a duration, it will fallback to parsing an integer number of seconds.
func GetFloat64 ¶ added in v1.1.0
GetFloat64 returns the float64 value of the environmental variable varName if the env var is empty or not a valid.
func GetHTTPTimeouts ¶
func GetHTTPTimeouts(envVar string, defaults netutil.HTTPTimeouts) (netutil.HTTPTimeouts, error)
GetHTTPTimeouts returns the timeouts that should be used for a HTTP client from the environment or uses provided default values.
NOTE: This function does not guarantee that every field of the returned netutil.HTTPTimeouts is going to be non-nil, instead this is ensured by netutil.NewHTTPTransport().
Types ¶
This section is empty.