MCPcopy Create free account
hub / github.com/LumaAI-API/Luma-API / GetOrDefault

Function GetOrDefault

common/utils.go:127–137  ·  view source on GitHub ↗
(env string, defaultValue int)

Source from the content-addressed store, hash-verified

125}
126
127func GetOrDefault(env string, defaultValue int) int {
128 if env == "" || os.Getenv(env) == "" {
129 return defaultValue
130 }
131 num, err := strconv.Atoi(os.Getenv(env))
132 if err != nil {
133 Logger.Error(fmt.Sprintf("failed to parse %s: %s, using default value: %d", env, err.Error(), defaultValue))
134 return defaultValue
135 }
136 return num
137}
138
139func GetOrDefaultString(env string, defaultValue string) string {
140 if env == "" || os.Getenv(env) == "" {

Callers 1

envs.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected