Major changes to the project

- Now the database process and the web process are separate.
- Added Map
- Added new graphing tools
This commit is contained in:
Pablo Revilla
2025-03-05 16:11:40 -08:00
parent 532fd7a56d
commit 5f97274e80
24 changed files with 1380 additions and 1101 deletions
+2 -14
View File
@@ -1,18 +1,16 @@
import asyncio
import argparse
import configparser
import json
from meshview import mqtt_reader
from meshview import database
from meshview import store
from meshview import mqtt_store
from meshview import web
from meshview import http
import json
async def load_database_from_mqtt(mqtt_server: str , mqtt_port: int, topic: list, mqtt_user: str | None = None, mqtt_passwd: str | None = None):
async for topic, env in mqtt_reader.get_topic_envelopes(mqtt_server, mqtt_port, topic, mqtt_user, mqtt_passwd):
await store.process_envelope(topic, env)
await mqtt_store.process_envelope(topic, env)
async def main(config):
@@ -28,9 +26,6 @@ async def main(config):
mqtt_topics = json.loads(config["mqtt"]["topics"])
async with asyncio.TaskGroup() as tg:
tg.create_task(
load_database_from_mqtt(config["mqtt"]["server"], int(config["mqtt"]["port"]), mqtt_topics, mqtt_user, mqtt_passwd)
)
tg.create_task(
web.run_server(
config["server"]["bind"],
@@ -38,13 +33,6 @@ async def main(config):
config["server"].get("tls_cert"),
)
)
if config["server"].get("acme_challenge"):
tg.create_task(
http.run_server(
config["server"]["bind"], config["server"]["acme_challenge"]
)
)
def load_config(file_path):
"""Load configuration from an INI-style text file."""