envBool renders the localized enabled/disabled/default labels for boolean envs (accepts 1/true/yes). When the var is unset and the default registry has a known boolean fallback, the rendered line is the localized enabled/disabled label tagged with defaultMarker so kv() reports e.g. "enabled (default
(name string)
| 257 | // reports e.g. "enabled (default)" instead of a bare "(default)" with |
| 258 | // no truth value attached. |
| 259 | func envBool(name string) string { |
| 260 | v := strings.ToLower(strings.TrimSpace(os.Getenv(name))) |
| 261 | switch v { |
| 262 | case "1", "true", "yes", "on": |
| 263 | return i18n.T("cfg.val.enabled") |
| 264 | case "0", "false", "no", "off": |
| 265 | return i18n.T("cfg.val.disabled") |
| 266 | case "": |
| 267 | if d, ok := lookupEnvDefault(name); ok && d.IsBool { |
| 268 | label := i18n.T("cfg.val.disabled") |
| 269 | if strings.EqualFold(d.Value, "true") { |
| 270 | label = i18n.T("cfg.val.enabled") |
| 271 | } |
| 272 | return defaultMarker + label |
| 273 | } |
| 274 | return i18n.T("cfg.val.default") |
| 275 | default: |
| 276 | return v |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | // shorten trims long values (paths, tokens) for display. |
| 281 | func shorten(s string, maxLen int) string { |