mirror of
https://github.com/pi-hole/FTL.git
synced 2026-10-06 04:03:17 +01:00
The Teleporter import ran the validators in its own caller, the config file ran none at all, and the legacy migration had a third copy - three loops over `CONFIG_ELEMENTS` disagreeing on when a parsed configuration is acceptable. Fold them into `validate_config()` and call it from `readFTLtoml()`, which both TOML paths go through. It runs once the whole file has been read rather than per item, because `migrate_config()` assigns values of its own afterwards: `dns.revServer` becomes `dns.revServers[0]` by joining four strings, and nothing checked the result. The rules spanning several items need the assembled configuration anyway, so the separate path check folds in as well. An archive is still refused outright, naming the offending item, and the error buffer carries that name out to the API. Refusing to start over one bad value in the config file would take DNS down for the whole network, so there the item goes back to its default and the reason is logged. Signed-off-by: DL6ER <dl6er@dl6er.de> (cherry picked from commit ccd269440a0ca0226e62bdbf9205a00e36efeca6)