feat: update README and main.py to clarify port usage and add error handling for socket port
All checks were successful
Build Docker Images for Pull Request / build (pull_request) Successful in 17m5s

This commit is contained in:
2025-02-20 23:55:46 +01:00
parent ffd83d8bbc
commit e1dc7bc5c9
2 changed files with 39 additions and 27 deletions

View File

@@ -230,7 +230,12 @@ if __name__ == '__main__':
setupStats(driver, url)
socket_url = firstValid(args.socket_url, os.getenv('SOCKET_URL'), default='localhost')
socket_port = firstValid(args.socket_port, os.getenv('SOCKET_PORT'), default=8094)
try:
socket_port = int(firstValid(args.socket_port, os.getenv('SOCKET_PORT'), default=8094))
except ValueError:
logger.error('Invalid socket port provided. Exiting.')
raise SystemExit(1)
logger.info('Starting server collector.')
httpd = HTTPServer(('', 9092), partial(Handler, downloadStats, driver, logger, socket_url, socket_port))
httpd.serve_forever()