forked from SAIC-iSmart-API/saic-python-mqtt-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (24 loc) · 906 Bytes
/
Copy pathmain.py
File metadata and controls
31 lines (24 loc) · 906 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
31
from __future__ import annotations
import asyncio
import faulthandler
import logging
import os
import signal
import sys
from configuration.parser import process_command_line
from mqtt_gateway import MqttGateway
if __name__ == "__main__":
# Keep this at the top!
from log_config import debug_log_enabled, setup_logging
setup_logging()
log = logging.getLogger(__name__)
log.info(
f"Starting SAIC MQTT Gateway version {os.environ.get('RELEASE_VERSION', 'unknown')}"
)
# Enable fault handler to get a thread dump on SIGQUIT
faulthandler.enable(file=sys.stderr, all_threads=True)
if hasattr(faulthandler, "register") and hasattr(signal, "SIGQUIT"):
faulthandler.register(signal.SIGQUIT, chain=False)
configuration = process_command_line()
mqtt_gateway = MqttGateway(configuration)
asyncio.run(mqtt_gateway.run(), debug=debug_log_enabled())