MCPcopy Create free account
hub / github.com/diillson/chatcli / envOr

Function envOr

cli/config_sections.go:243–251  ·  view source on GitHub ↗

envOr returns the env value, or the registered runtime default tagged with defaultMarker so kv() can color it as "(default)", or the localized "(not set)" placeholder when neither source has a value. The default registry is consulted only when the env is unset — an explicitly-set empty string still

(name string)

Source from the content-addressed store, hash-verified

241// explicitly-set empty string still goes through the not_set branch
242// (matching pre-registry behavior).
243func envOr(name string) string {
244 if v := strings.TrimSpace(os.Getenv(name)); v != "" {
245 return v
246 }
247 if d, ok := lookupEnvDefault(name); ok && !d.IsBool {
248 return defaultMarker + formatDefaultValue(d.Value)
249 }
250 return i18n.T("cfg.val.not_set")
251}
252
253// envBool renders the localized enabled/disabled/default labels for boolean
254// envs (accepts 1/true/yes). When the var is unset and the default

Callers 15

showConfigQualityMethod · 0.85
showConfigSchedulerMethod · 0.85
showConfigGeneralMethod · 0.85
showConfigProvidersMethod · 0.85
showConfigAgentMethod · 0.85
showConfigResilienceMethod · 0.85
showConfigSessionMethod · 0.85
showConfigDiagramMethod · 0.85
showConfigGraphViewMethod · 0.85
showConfigAuthMethod · 0.85
showConfigSecurityMethod · 0.85

Calls 3

TFunction · 0.92
lookupEnvDefaultFunction · 0.85
formatDefaultValueFunction · 0.85

Tested by

no test coverage detected