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)
| 241 | // explicitly-set empty string still goes through the not_set branch |
| 242 | // (matching pre-registry behavior). |
| 243 | func 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 |
no test coverage detected