Documentation ¶
Overview ¶
Package env provides easy way to bind environment variables
Index ¶
- func Bind(s interface{}) (err error)
- func GetEnvAsArrayOfBoolOrFallback(key string, defaultValue []bool) (bools []bool, err error)
- func GetEnvAsArrayOfFloat64OrFallback(key string, defaultValue []float64) (floats []float64, err error)
- func GetEnvAsArrayOfIntsOrFallback(key string, defaultValue []int) (ints []int, err error)
- func GetEnvAsArrayOfStringsOrFallback(key string, defaultValue []string) []string
- func GetEnvAsBoolOrFallback(key string, defaultValue bool) (val bool, err error)
- func GetEnvAsFloat64OrFallback(key string, defaultValue float64) (float64, error)
- func GetEnvAsIntOrFallback(key string, defaultValue int) (int, error)
- func GetEnvAsStringOrFallback(key, defaultValue string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnvAsArrayOfBoolOrFallback ¶
GetEnvAsArrayOfBoolOrFallback returns the env variable for the given key and falls back to the given defaultValue if not set
func GetEnvAsArrayOfFloat64OrFallback ¶
func GetEnvAsArrayOfFloat64OrFallback(key string, defaultValue []float64) (floats []float64, err error)
GetEnvAsArrayOfFloat64OrFallback returns the env variable for the given key and falls back to the given defaultValue if not set
func GetEnvAsArrayOfIntsOrFallback ¶
GetEnvAsArrayOfIntsOrFallback returns the env variable for the given key and falls back to the given defaultValue if not set
func GetEnvAsArrayOfStringsOrFallback ¶
GetEnvAsArrayOfStringsOrFallback returns the env variable for the given key and falls back to the given defaultValue if not set GetEnvAsArrayOfStringsOrFallback trims all whitespaces from input i.e. "us, fr, au" -> {"us","fr","au"}
func GetEnvAsBoolOrFallback ¶
GetEnvAsBoolOrFallback returns the env variable for the given key, parses it as boolean and falls back to the given defaultValue if not set
func GetEnvAsFloat64OrFallback ¶
GetEnvAsFloat64OrFallback returns the env variable (parsed as float64) for the given key and falls back to the given defaultValue if not set
func GetEnvAsIntOrFallback ¶
GetEnvAsIntOrFallback returns the env variable (parsed as integer) for the given key and falls back to the given defaultValue if not set
func GetEnvAsStringOrFallback ¶
GetEnvAsStringOrFallback returns the env variable for the given key and falls back to the given defaultValue if not set
Types ¶
This section is empty.