MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / GetEnvOrDefaultBool

Function GetEnvOrDefaultBool

common/env.go:28–38  ·  view source on GitHub ↗
(env string, defaultValue bool)

Source from the content-addressed store, hash-verified

26}
27
28func GetEnvOrDefaultBool(env string, defaultValue bool) bool {
29 if env == "" || os.Getenv(env) == "" {
30 return defaultValue
31 }
32 b, err := strconv.ParseBool(os.Getenv(env))
33 if err != nil {
34 SysError(fmt.Sprintf("failed to parse %s: %s, using default value: %t", env, err.Error(), defaultValue))
35 return defaultValue
36 }
37 return b
38}

Callers 2

InitEnvFunction · 0.85
initConstantEnvFunction · 0.85

Calls 2

SysErrorFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected