Documentation ¶
Index ¶
- func ParseBoolFromEnv(envVar string, defaultValue bool) bool
- func ParseDurationFromEnv(env string, defaultValue, min, max time.Duration) time.Duration
- func ParseFloat64FromEnv(env string, defaultValue, min, max float64) float64
- func ParseFloatFromEnv(env string, defaultValue, min, max float32) float32
- func ParseInt64FromEnv(env string, defaultValue, min, max int64) int64
- func ParseNumFromEnv(env string, defaultValue, min, max int) int
- func ParseStringToStringFromEnv(envVar string, defaultValue map[string]string, seperator string) map[string]string
- func StringFromEnv(env string, defaultValue string, opts ...StringFromEnvOpts) string
- func StringsFromEnv(env string, defaultValue []string, separator string) []string
- type StringFromEnvOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseBoolFromEnv ¶
ParseBoolFromEnv retrieves a boolean value from given environment envVar. Returns default value if envVar is not set.
nolinit:unparam
func ParseDurationFromEnv ¶
Helper function to parse a time duration from an environment variable. Returns a default if env is not set, is not parseable to a duration, exceeds max (if max is greater than 0) or is less than min.
nolinit:unparam
func ParseFloat64FromEnv ¶
Helper function to parse a float64 from an environment variable. Returns a default if env is not set, is not parseable to a number, exceeds max (if max is greater than 0) or is less than min (and min is greater than 0).
nolint:unparam
func ParseFloatFromEnv ¶
Helper function to parse a float32 from an environment variable. Returns a default if env is not set, is not parseable to a number, exceeds max (if max is greater than 0) or is less than min (and min is greater than 0).
nolint:unparam
func ParseInt64FromEnv ¶
Helper function to parse a int64 from an environment variable. Returns a default if env is not set, is not parseable to a number, exceeds max (if max is greater than 0) or is less than min.
nolint:unparam
func ParseNumFromEnv ¶
Helper function to parse a number from an environment variable. Returns a default if env is not set, is not parseable to a number, exceeds max (if max is greater than 0) or is less than min.
nolint:unparam
func ParseStringToStringFromEnv ¶
func ParseStringToStringFromEnv(envVar string, defaultValue map[string]string, seperator string) map[string]string
ParseStringToStringVar parses given value from the environment as a map of string. Returns default value if envVar is not set.
func StringFromEnv ¶
func StringFromEnv(env string, defaultValue string, opts ...StringFromEnvOpts) string
func StringsFromEnv ¶
StringsFromEnv parses given value from the environment as a list of strings, using seperator as the delimeter, and returns them as a slice. The strings in the returned slice will have leading and trailing white space removed.
Types ¶
type StringFromEnvOpts ¶
type StringFromEnvOpts struct { // AllowEmpty allows the value to be empty as long as the environment variable is set. AllowEmpty bool }