diff --git a/routlin/mod_validation.py b/routlin/mod_validation.py index 36c775b..d1f0652 100644 --- a/routlin/mod_validation.py +++ b/routlin/mod_validation.py @@ -502,11 +502,11 @@ def validate_config(data): for idx, bl in enumerate(data.get("dns_blocking", {}).get("blocklists", [])): name = bl.get("name", "") label = f"dns_blocking.blocklists[{idx}] '{name}'" - for field in ("name", "description", "save_as", "url", "format"): + bl_type = bl.get("bl_type", "community") + required = ("name", "description", "save_as") + (() if bl_type == "local" else ("url",)) + for field in required: if not bl.get(field): errors.append(f"{label}: missing or empty field '{field}'.") - if bl.get("format") and bl["format"] not in VALID_BLOCKLIST_FORMATS: - errors.append(f"{label}: format must be one of: {', '.join(sorted(VALID_BLOCKLIST_FORMATS))}.") if name: err = check_blocklist_name_unique( data.get("dns_blocking", {}).get("blocklists", []), name, exclude_idx=idx