]> www.average.org Git - loctrkd.git/commitdiff
Adjust config to changing messaging topology
authorEugene Crosser <crosser@average.org>
Tue, 26 Jul 2022 15:09:40 +0000 (17:09 +0200)
committerEugene Crosser <crosser@average.org>
Tue, 26 Jul 2022 15:09:40 +0000 (17:09 +0200)
debian/loctrkd.conf
loctrkd/__main__.py
loctrkd/collector.py
loctrkd/mkgpx.py
loctrkd/qry.py
loctrkd/rectifier.py
loctrkd/watch.py
loctrkd/wsgateway.py
test/common.py

index 9f45a0806e91e14dfebf8e67594dcdfc804e143a..a28104335b9468519538643ddff578d2fba8a04f 100644 (file)
@@ -1,11 +1,13 @@
+[common]
+# comma-separated list of tracker protocols to accept
+protocols = zx303proto,beesure
+
 [collector]
 # configure your gps terminal with this SMS:
 # "server#<your_server_ip_or_fqdn>#4303#"
 port = 4303
 publishurl = ipc:///var/lib/loctrkd/collected
 listenurl = ipc:///var/lib/loctrkd/responses
-# comma-separated list of tracker protocols to accept
-protocols = zx303proto
 
 [wsgateway]
 port = 5049
@@ -18,7 +20,8 @@ dbfn = /var/lib/loctrkd/trkloc.sqlite
 # "opencellid" and "googlemaps" can be here. Both require an access token,
 # though googlemaps is only online, while opencellid backend looks up a
 # local database, that can be updated once a week or once a month.
-backend = opencellid
+lookaside = opencellid
+publishurl = ipc:///var/lib/loctrkd/rectified
 
 [opencellid]
 dbfn = /var/lib/opencellid/opencellid.sqlite
@@ -28,6 +31,10 @@ dbfn = /var/lib/opencellid/opencellid.sqlite
 downloadtoken = /var/lib/opencellid/opencellid.token
 downloadmcc = 262
 
+# For googlemaps lookaside backend, specify the token
+# [googlemaps]
+# accesstoken = google.token
+
 [termconfig]
 statusIntervalMinutes = 25
 uploadIntervalSeconds = 0x0300
index 10a2bf835d80ea946d3ca92ca71da02f555dbfba..bba38ff1f1321f3ac76a62e69eefebe7db8c0bc9 100644 (file)
@@ -26,7 +26,7 @@ def main(
     global pmods
     pmods = [
         cast(ProtoModule, import_module("." + modnm, __package__))
-        for modnm in conf.get("collector", "protocols").split(",")
+        for modnm in conf.get("common", "protocols").split(",")
     ]
     # Is this https://github.com/zeromq/pyzmq/issues/1627 still not fixed?!
     zctx = zmq.Context()  # type: ignore
index 75cd33b861c374021c12d478631eff22c3cfcc4a..17c98d5d98326af76dad80c2dc760bb3fb19c4ce 100644 (file)
@@ -184,7 +184,7 @@ def runserver(conf: ConfigParser, handle_hibernate: bool = True) -> None:
     global pmods
     pmods = [
         cast(ProtoModule, import_module("." + modnm, __package__))
-        for modnm in conf.get("collector", "protocols").split(",")
+        for modnm in conf.get("common", "protocols").split(",")
     ]
     # Is this https://github.com/zeromq/pyzmq/issues/1627 still not fixed?!
     zctx = zmq.Context()  # type: ignore
index 6c1ce002327bb0e49f29bb0af9725ffa2ed38e60..35ff77e8b2a23dfbfc8682376f7a1074133003ab 100644 (file)
@@ -28,7 +28,7 @@ def main(
     global pmods
     pmods = [
         cast(ProtoModule, import_module("." + modnm, __package__))
-        for modnm in conf.get("collector", "protocols").split(",")
+        for modnm in conf.get("common", "protocols").split(",")
     ]
     db = connect(conf.get("storage", "dbfn"))
     c = db.cursor()
index 6745cf27653ddf592ef3fd47536b3c449b0a60b4..fc647c74c687b840d9fe9d2d63321d23f7b43c0f 100644 (file)
@@ -24,7 +24,7 @@ def main(
     global pmods
     pmods = [
         cast(ProtoModule, import_module("." + modnm, __package__))
-        for modnm in conf.get("collector", "protocols").split(",")
+        for modnm in conf.get("common", "protocols").split(",")
     ]
     db = connect(conf.get("storage", "dbfn"))
     c = db.cursor()
index 5ef6d35f77c32d79c2f696ceb032be08f1cb7231..5919cbd2bd9c69437c052eff97d75b157eb3b050 100644 (file)
@@ -16,7 +16,7 @@ log = getLogger("loctrkd/rectifier")
 
 
 def runserver(conf: ConfigParser) -> None:
-    qry = import_module("." + conf.get("rectifier", "backend"), __package__)
+    qry = import_module("." + conf.get("rectifier", "lookaside"), __package__)
     qry.init(conf)
     # Is this https://github.com/zeromq/pyzmq/issues/1627 still not fixed?!
     zctx = zmq.Context()  # type: ignore
index 006ec06d18ab8505c5b712e891f03eb56184b0a2..8e962bc2278dcef0b8eda170116dae0be702df2a 100644 (file)
@@ -21,7 +21,7 @@ def runserver(conf: ConfigParser) -> None:
     global pmods
     pmods = [
         cast(ProtoModule, import_module("." + modnm, __package__))
-        for modnm in conf.get("collector", "protocols").split(",")
+        for modnm in conf.get("common", "protocols").split(",")
     ]
     # Is this https://github.com/zeromq/pyzmq/issues/1627 still not fixed?!
     zctx = zmq.Context()  # type: ignore
index 01a80426d84f56c98301c3c92a682c98e05c6259..b6d10e84798f89e7b36e322074f9afb115d50489 100644 (file)
@@ -261,7 +261,7 @@ def runserver(conf: ConfigParser) -> None:
     global htmlfile, pmods, selector
     pmods = [
         cast(ProtoModule, import_module("." + modnm, __package__))
-        for modnm in conf.get("collector", "protocols").split(",")
+        for modnm in conf.get("common", "protocols").split(",")
     ]
     for pmod in pmods:
         for proto, is_incoming in pmod.exposed_protos():
index 761ea6721a267c832af4d3dfca910f6cbbb2dbb9..17fde963e448ac8a76d2ebd3d25742d91905bd8f 100644 (file)
@@ -39,11 +39,13 @@ class TestWithServers(TestCase):
                 freeports.append(sk.getsockname()[1])
         _, self.tmpfilebase = mkstemp()
         self.conf = ConfigParser()
+        self.conf["common"] = {
+            "protocols": "zx303proto",
+        }
         self.conf["collector"] = {
             "port": str(freeports[0]),
             "publishurl": "ipc://" + self.tmpfilebase + ".pub",
             "listenurl": "ipc://" + self.tmpfilebase + ".pul",
-            "protocols": "zx303proto",
         }
         self.conf["storage"] = {
             "dbfn": self.tmpfilebase + ".storage.sqlite",
@@ -53,7 +55,7 @@ class TestWithServers(TestCase):
             "downloadurl": f"http://localhost:{freeports[2]}/test/262.csv.gz",
         }
         self.conf["rectifier"] = {
-            "backend": "opencellid",
+            "lookaside": "opencellid",
         }
         self.conf["wsgateway"] = {
             "port": str(freeports[1]),