add: agent template

This commit is contained in:
Toolf
2024-02-02 22:51:54 +02:00
commit 1f92b43879
16 changed files with 1749 additions and 0 deletions

17
agent/src/config.py Normal file
View File

@@ -0,0 +1,17 @@
import os
def try_parse(type, value: str):
try:
return type(value)
except Exception:
return None
# MQTT config
MQTT_BROKER_HOST = os.environ.get("MQTT_BROKER_HOST") or "mqtt"
MQTT_BROKER_PORT = try_parse(int, os.environ.get("MQTT_BROKER_PORT")) or 1883
MQTT_TOPIC = os.environ.get("MQTT_TOPIC") or "agent"
# Delay for sending data to mqtt in seconds
DELAY = try_parse(float, os.environ.get("DELAY")) or 1