MCPcopy Index your code
hub / github.com/jetify-com/devbox / GetValueOrDefault

Function GetValueOrDefault

internal/envir/util.go:40–47  ·  view source on GitHub ↗

GetValueOrDefault gets the value of an environment variable. If it's empty, it will return the given default value instead.

(key, def string)

Source from the content-addressed store, hash-verified

38// GetValueOrDefault gets the value of an environment variable.
39// If it's empty, it will return the given default value instead.
40func GetValueOrDefault(key, def string) string {
41 val := os.Getenv(key)
42 if val == "" {
43 val = def
44 }
45
46 return val
47}
48
49// MapToPairs creates a slice of environment variable "key=value" pairs from a
50// map.

Callers 1

ClientFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected