Added command line argument for explicite CA certificate choice
This commit is contained in:
+4
-1
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user