From: Arran Cudbard-Bell Date: Wed, 24 May 2023 01:21:26 +0000 (-0400) Subject: radhttpcheck: Allow config path to be specified X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7f68ea4d891b7a53852eebb2d84a3c1bc540141;p=thirdparty%2Ffreeradius-server.git radhttpcheck: Allow config path to be specified --- diff --git a/scripts/health/radhttpcheck/radhttpcheck.py b/scripts/health/radhttpcheck/radhttpcheck.py index 57658671ab0..5fe76f69fca 100755 --- a/scripts/health/radhttpcheck/radhttpcheck.py +++ b/scripts/health/radhttpcheck/radhttpcheck.py @@ -26,6 +26,7 @@ from pyrad.client import Client, Timeout from pyrad.dictionary import Dictionary import pyrad.packet +import argparse import json import yaml @@ -234,8 +235,12 @@ def main(): global config global raddict + parser = argparse.ArgumentParser(description='HTTP to RADIUS healthcheck') + parser.add_argument('-c', '--conf', default='radhttpcheck.yml', help='path to configuration file') + args = parser.parse_args() + # Parse our configuration, setting defaults - config = Configuration() + config = Configuration(args.conf) # Start the HTTP server with ThreadedHTTPServer((config.listen['ipaddr'], config.listen['port']), RadiusHealthCheckHandler) as httpd: diff --git a/scripts/health/radhttpcheck/radhttpcheck.service b/scripts/health/radhttpcheck/radhttpcheck.service index 20450d5312b..bdfc1a27595 100644 --- a/scripts/health/radhttpcheck/radhttpcheck.service +++ b/scripts/health/radhttpcheck/radhttpcheck.service @@ -5,7 +5,7 @@ Documentation=raddhtpcheck/README.md [Service] Type=exec -ExecStart=/usr/local/radhttpcheck/radhttpcheck.py +ExecStart=/usr/local/radhttpcheck/radhttpcheck.py --conf /usr/local/radhttpcheck/radhttpcheck.yml Restart=on-failure RestartSec=5 diff --git a/scripts/health/radhttpcheck/radhttpcheck.yml b/scripts/health/radhttpcheck/radhttpcheck.yml index 0a5de4597eb..12d06114dd1 100644 --- a/scripts/health/radhttpcheck/radhttpcheck.yml +++ b/scripts/health/radhttpcheck/radhttpcheck.yml @@ -1,7 +1,7 @@ # Address listened on for HTTP traffic listen: address: '*' - port: 8000 + port: 8080 # URLs the healthcheck script will respond on, and the various types of requests they create endpoints: '/acct':