Added command line argument for explicite CA certificate choice

This commit is contained in:
2026-08-21 20:38:52 +02:00
parent 26e5215ffe
commit 3a71b3e48b
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -8,17 +8,20 @@ from datetime import datetime
from pathlib import Path
api_url = "https://pi.hole/api"
verify = "/etc/pihole/tls_ca.crt"
default_ca_cert = "/etc/pihole/tls_ca.crt"
default_password_file = "/etc/pihole/api_password"
parser = argparse.ArgumentParser(description="List non-static (dynamic) Pi-hole DHCP leases.")
parser.add_argument("-p", "--password-file", default=default_password_file,
help=f"Path to file containing the Pi-hole API password (default: {default_password_file})")
parser.add_argument("-c", "--ca-cert", default=default_ca_cert,
help=f"Path to the Pi-hole TLS CA certificate for verification (default: {default_ca_cert})")
parser.add_argument("-t", "--table", action="store_true",
help="Print a human-readable aligned table (with local time expiry)")
parser.add_argument("-j", "--json", action="store_true",
help="Print machine-readable output as JSON instead of the default CSV")
args = parser.parse_args()
verify = args.ca_cert
if args.table and args.json:
parser.error("--table and --json are mutually exclusive")