mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
Six env flags, two conventions, and both failed silently against the other. Five read `== "true"`, so BOOTNODE_ENABLED=1 left bootnode off and CALENDAR_ENABLED=1 left the calendar off. One read `!= "1"`, so BASE_ENABLE_ADMIN_UI=true served no admin. And ZAP_DISABLED read `!= "true"`, so an operator who wrote ZAP_DISABLED=1 to stop the listener watched it come up anyway. In every case the flag was accepted, ignored, and never mentioned again. This tree already answers "read a boolean from a string" four times, with strconv.ParseBool (tools/filesystem, tools/search, tools/router, core/settings_query). The hand-rolled comparisons were the deviation, so osutils.Bool is that answer given a name and a default, and all six sites read it. Strictly more permissive: every spelling that worked before still works, and the ones that silently did nothing now do what they say. An unparseable value yields the default rather than its opposite — someone who typed something meaningless has not asked for the other thing. Coverage: plugins/zap 5.9% -> 23.5%, and DefaultConfig is pinned including the case that started this (ZAP_DISABLED=1 must disable) and a garbage ZAP_PORT, which must keep 9999 rather than quietly binding somewhere else. Co-authored-by: Hanzo Dev <[email protected]>