Documentation ¶
Index ¶
- Constants
- func Get(envKey string) (value string)
- func GetOrDefault(e string, defaultValue string) (value string)
- func Lookup(envKey string) (value string, present bool)
- func LookupOrFalse(envKey string) string
- func Set(envKey string, value string) (err error)
- func Truthy(envKey string) (truth bool)
- type EnvironmentGetter
- type EnvironmentLookup
- type EnvironmentSetter
Constants ¶
const ( // KubeConfig is the ENV variable to fetch kubernetes kubeconfig KubeConfig = "OPENEBS_IO_KUBE_CONFIG" // KubeMaster is the ENV variable to fetch kubernetes master's address KubeMaster = "OPENEBS_IO_K8S_MASTER" )
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get fetches value from the provided environment variable
NOTE:
This is an implementation of EnvironmentGetter
func GetOrDefault ¶
GetOrDefault fetches value from the provided environment variable which on empty returns the defaultValue NOTE: os.Getenv is used here instead of os.LookupEnv because it is not required to know if the environment variable is defined on the system
func Lookup ¶
Lookup looks up an environment variable
NOTE:
This is an implementation of EnvironmentLookup
func LookupOrFalse ¶
LookupOrFalse looks up an environment variable and returns a string "false" if environment variable is not present. It returns appropriate values for other cases.
Types ¶
type EnvironmentGetter ¶
EnvironmentGetter abstracts fetching value from an environment variable
type EnvironmentLookup ¶
EnvironmentLookup abstracts looking up an environment variable
type EnvironmentSetter ¶
EnvironmentSetter abstracts setting of environment variable