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, separator 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 ¶ added in v2.1.0
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 ¶ added in v2.10.0
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 ¶ added in v2.3.0
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 ¶ added in v2.2.0
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 ¶ added in v2.10.0
func ParseStringToStringFromEnv(envVar string, defaultValue map[string]string, separator 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 ¶ added in v2.4.4
StringsFromEnv parses given value from the environment as a list of strings, using separator 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 ¶ added in v2.8.11
type StringFromEnvOpts struct { // AllowEmpty allows the value to be empty as long as the environment variable is set. AllowEmpty bool }