-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (20 loc) · 938 Bytes
/
main.py
File metadata and controls
30 lines (20 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Entry point for running the monitoring service."""
from __future__ import annotations
import argparse
from app import bootstrap
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Network performance monitor")
parser.add_argument("--config", help="Path to config.yaml", default="config.yaml")
parser.add_argument("--host", default=None, help="Override web server host")
parser.add_argument("--port", type=int, default=None, help="Override web server port")
parser.add_argument("--debug", action="store_true", help="Enable Flask debug mode")
return parser.parse_args()
def main() -> None:
args = parse_args()
context = bootstrap(args.config)
context.start()
host = args.host or context.config.web.host
port = args.port or context.config.web.port
context.web_app.run(host=host, port=port, debug=args.debug)
if __name__ == "__main__":
main()