Documentation ¶
Index ¶
- func Get(envKey ENVKey) (value string)
- func GetOrDefault(e ENVKey, defaultValue string) (value string)
- func Lookup(envKey ENVKey) (value string, present bool)
- func LookupOrFalse(envKey ENVKey) string
- func Set(envKey ENVKey, value string) (err error)
- func Truthy(envKey ENVKey) (truth bool)
- type ENVKey
- type EnvironmentGetter
- type EnvironmentLookup
- type EnvironmentSetter
Constants ¶
This section is empty.
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 ENVKey ¶
type ENVKey string
ENVKey is a typed string to represent various environment keys used by this binary
const ( // KubeConfig is the ENV variable to fetch kubernetes kubeconfig KubeConfig ENVKey = "OPENEBS_IO_KUBE_CONFIG" // KubeMaster is the ENV variable to fetch kubernetes master's address KubeMaster ENVKey = "OPENEBS_IO_K8S_MASTER" // OpenEBSEnableAnalytics is the environment variable to get user's consent to // send usage data to OpenEBS core-developers using the Google Analytics platform OpenEBSEnableAnalytics ENVKey = "OPENEBS_IO_ENABLE_ANALYTICS" // OpenEBSVersion is the environment variable to get openebs version OpenEBSVersion ENVKey = "OPENEBS_IO_VERSION" // OpenEBSNamespace is the environment variable to get openebs namespace // // This environment variable is set via kubernetes downward API OpenEBSNamespace = "OPENEBS_NAMESPACE" // OpenEBSMayaPodName is the environment variable to get maya-apiserver pod // name // // This environment variable is set via kubernetes downward API OpenEBSMayaPodName ENVKey = "OPENEBS_MAYA_POD_NAME" // OpenEBSServiceAccount is the environment variable to get openebs // serviceaccount // // This environment variable is set via kubernetes downward API OpenEBSServiceAccount ENVKey = "OPENEBS_SERVICE_ACCOUNT" )
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