Documentation
¶
Index ¶
- func Environ() []string
- func Get(key, defaultValue string) string
- func GetDuration(key string, defaultValue time.Duration) (time.Duration, error)
- func GetInt(key string, defaultValue int) (int, error)
- func IsSet(key string) bool
- func List(prefix string) (envs []string)
- func LockSetEnv() func()
- func LookupEnv(key string) (string, string, string, error)
- func RegisterGlobalCAs(CAs *x509.CertPool)
- func SetEnvOff()
- func SetEnvOn()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Environ ¶
func Environ() []string
Environ returns a copy of strings representing the environment, in the form "key=value".
func Get ¶
Get returns the value of the environment variable named by key. If the variable is unset or set to an empty string, defaultValue is returned.
func GetDuration ¶
GetDuration returns a parsed time.Duration if found in the environment value, returns the default value duration otherwise.
func GetInt ¶
GetInt returns an integer if found in the environment and returns the default value otherwise.
func IsSet ¶
IsSet returns if the given env key is set. remember ENV must be a non-empty. All empty values are considered unset.
func LockSetEnv ¶
func LockSetEnv() func()
LockSetEnv locks modifications to environment. Call returned function to unlock.
func LookupEnv ¶
LookupEnv retrieves the value of the environment variable named by `key`.
If the value of the variable starts with "env://" or "env+tls://" it is fetched from the referenced remote server. The fetched value is cached in a separate environment variable prefixed with an underscore for subsequent lookups should the remote server be unreachable. When fetching from a remote server the username and password used are also returned.
For regular environment variables the value is returned as-is with empty credentials.
func RegisterGlobalCAs ¶
RegisterGlobalCAs register the global root CAs
Types ¶
This section is empty.