sem8-iot-test/agent/src/config.py
hasslesstech 43691cc932
Some checks failed
Test Agent / test-agent-run (push) Failing after 0s
Test Agent / job-cleanup (push) Failing after 1m4s
lab1: add CI/CD testing
2026-02-23 23:53:42 +02:00

22 lines
532 B
Python

import os
def try_parse(type, value: str):
try:
return type(value)
except Exception:
return None
USER_ID = 1
# 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
# Testing switches for CI/CD
MAX_SENDS = try_parse(int, os.environ.get("MAX_SENDS"))