]> www.average.org Git - loctrkd.git/commitdiff
make termconfig use unit specific config section
authorEugene Crosser <crosser@average.org>
Tue, 31 May 2022 20:54:24 +0000 (22:54 +0200)
committerEugene Crosser <crosser@average.org>
Tue, 31 May 2022 20:54:24 +0000 (22:54 +0200)
gps303/termconfig.py

index eb3150b49a17065aed2fc1d8898bc80ffa4e28b7..953e6aec75f67ae380732d7f80dcfcc4cfa845ed 100644 (file)
@@ -14,7 +14,6 @@ log = getLogger("gps303/termconfig")
 
 
 def runserver(conf: ConfigParser) -> None:
-    termconfig = common.normconf(conf["termconfig"])
     # Is this https://github.com/zeromq/pyzmq/issues/1627 still not fixed?!
     zctx = zmq.Context()  # type: ignore
     zsub = zctx.socket(zmq.SUB)  # type: ignore
@@ -43,6 +42,10 @@ def runserver(conf: ConfigParser) -> None:
                 log.error(
                     "%s does not expect externally provided response", msg
                 )
+            if zmsg.imei is not None and conf.has_section(zmsg.imei):
+                termconfig = common.normconf(conf[zmsg.imei])
+            else:
+                termconfig = common.normconf(conf["termconfig"])
             kwargs = {}
             if isinstance(msg, STATUS):
                 kwargs = {