env

package
v2.7.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBoolFromEnv added in v2.1.0

func ParseBoolFromEnv(envVar string, defaultValue bool) bool

ParseBoolFromEnv retrieves a boolean value from given environment envVar. Returns default value if envVar is not set.

nolinit:unparam

func ParseDurationFromEnv

func ParseDurationFromEnv(env string, defaultValue, min, max time.Duration) time.Duration

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 ParseFloatFromEnv added in v2.3.0

func ParseFloatFromEnv(env string, defaultValue, min, max float32) float32

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

func ParseInt64FromEnv(env string, defaultValue, min, max int64) int64

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

func ParseNumFromEnv(env string, defaultValue, min, max int) int

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 StringFromEnv

func StringFromEnv(env string, defaultValue string) string

func StringsFromEnv added in v2.4.4

func StringsFromEnv(env string, defaultValue []string, separator string) []string

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

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL