mirror of
https://github.com/unpoller/unpoller.git
synced 2026-09-30 03:21:28 +02:00
`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>
109 lines
2.4 KiB
JSON
109 lines
2.4 KiB
JSON
{
|
|
"poller": {
|
|
"debug": false,
|
|
"quiet": false,
|
|
"plugins": [],
|
|
"log_unknown_types": false
|
|
},
|
|
|
|
"prometheus": {
|
|
"disable": false,
|
|
"http_listen": "0.0.0.0:9130",
|
|
"ssl_cert_path": "",
|
|
"ssl_key_path": "",
|
|
"report_errors": false,
|
|
"interval": "60s"
|
|
},
|
|
|
|
"influxdb": {
|
|
"disable": false,
|
|
"url": "http://127.0.0.1:8086",
|
|
"user": "unifipoller",
|
|
"pass": "unifipoller",
|
|
"db": "unifi",
|
|
"verify_ssl": false,
|
|
"interval": "30s",
|
|
"tags": {
|
|
"customer": "abc_corp",
|
|
"env": "prod"
|
|
}
|
|
},
|
|
|
|
"webserver": {
|
|
"enable": false,
|
|
"port": 37288,
|
|
"html_path": "/usr/local/lib/unpoller/web",
|
|
"ssl_cert_path": "",
|
|
"ssl_key_path": "",
|
|
"max_events": 200,
|
|
"accounts": {
|
|
"captain": "$2a$04$mxw6i0LKH6u46oaLK2cq5eCTAAFkfNiRpzNbz.EyvJZZWNa2FzIlS"
|
|
}
|
|
},
|
|
|
|
"datadog": {
|
|
"enable": false,
|
|
"address": "localhost:8125",
|
|
"namespace": "",
|
|
"tags": [
|
|
"customer:abcde"
|
|
]
|
|
},
|
|
|
|
"unifi": {
|
|
"dynamic": false,
|
|
"defaults": {
|
|
"user": "unifipoller",
|
|
"pass": "unifipoller",
|
|
"url": "https://127.0.0.1:8443",
|
|
"sites": ["all"],
|
|
"timeout": "60s",
|
|
"save_ids": false,
|
|
"save_events": false,
|
|
"save_alarms": false,
|
|
"save_anomalies": false,
|
|
"save_dpi": false,
|
|
"save_sites": true,
|
|
"hash_pii": false,
|
|
"verify_ssl": false,
|
|
"default_site_name_override": "My Custom Default Site"
|
|
},
|
|
"controllers": [
|
|
{
|
|
"user": "unifipoller",
|
|
"pass": "unifipoller",
|
|
"url": "https://127.0.0.1:8443",
|
|
"sites": ["all"],
|
|
"save_ids": false,
|
|
"save_events": false,
|
|
"save_alarms": false,
|
|
"save_anomalies": false,
|
|
"save_dpi": false,
|
|
"save_sites": true,
|
|
"hash_pii": false,
|
|
"verify_ssl": false
|
|
}
|
|
]
|
|
},
|
|
|
|
"unas": {
|
|
"//": "UNAS Pro consoles. JSON cannot carry comments, so this section ships off: it shows the shape, and setting enable to true with a real url turns it on.",
|
|
"enable": false,
|
|
"defaults": {
|
|
"user": "unpoller",
|
|
"pass": "",
|
|
"verify_ssl": false,
|
|
"timeout": "60s"
|
|
},
|
|
"devices": [
|
|
{
|
|
"url": "https://192.168.1.10",
|
|
"user": "unpoller",
|
|
"pass": "unpoller",
|
|
"verify_ssl": false,
|
|
"timeout": "60s"
|
|
}
|
|
]
|
|
}
|
|
}
|