mirror of
https://github.com/unpoller/unpoller.git
synced 2026-10-21 10:16:07 +02:00
refactor(unas): replace disable flag with enable, defaulting to off
`disable = false` is a double negative, and a bool named disable cannot express opt-in anyway: it zero-values to false, so the flag was inert and opt-in rested entirely on the device list being empty. `enable` defaults to false and is now the real gate -- Initialize, Metrics and DebugInput all return early unless it is set. The two existing guards remain: an empty device list is still a no-op, and no default URL is ever synthesized. Configuring devices while enable is false is always a mistake, so that combination logs one error instead of silently collecting nothing. Adds binding tests for the flag across toml, json, yaml and UP_UNAS_ENABLE (the env name derives from the xml tag, not the json one), plus a test that all three shipped examples default to off. Both were verified by mutation: breaking a struct tag or flipping an example fails the suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
3d178bed8d
commit
01ac7ca2b7
@@ -91,7 +91,7 @@ unifi:
|
||||
# by its own input plugin with its own credentials and host -- not as a UniFi controller.
|
||||
# This section is optional: with no devices configured the plugin stays silent and inert.
|
||||
#unas:
|
||||
# disable: false
|
||||
# enable: true
|
||||
# defaults:
|
||||
# user: "unpoller"
|
||||
# pass: ""
|
||||
|
||||
Reference in New Issue
Block a user