introduce nginex-proxy
use host ip if working in wsl
This commit is contained in:
@@ -5,6 +5,7 @@ import threading
|
||||
import time
|
||||
from dotenv import load_dotenv
|
||||
import paho.mqtt.client as mqtt
|
||||
import random
|
||||
|
||||
# 1. Laden der Umgebungsvariablen aus .env
|
||||
load_dotenv(dotenv_path=os.path.join(os.path.dirname(__file__), "..", ".env"))
|
||||
@@ -15,7 +16,9 @@ MQTT_BROKER_PORT = int(os.getenv("MQTT_BROKER_PORT", "1883"))
|
||||
MQTT_USERNAME = os.getenv("MQTT_USERNAME", None)
|
||||
MQTT_PASSWORD = os.getenv("MQTT_PASSWORD", None)
|
||||
MQTT_KEEPALIVE = int(os.getenv("MQTT_KEEPALIVE", "60"))
|
||||
MQTT_CLIENT_ID = os.getenv("MQTT_CLIENT_ID", f"dash-{int(time.time())}")
|
||||
base_id = os.getenv("MQTT_CLIENT_ID", "dash")
|
||||
unique_part = f"{os.getpid()}_{random.randint(1000,9999)}"
|
||||
MQTT_CLIENT_ID = f"{base_id}-{unique_part}"
|
||||
|
||||
# 3. Erstelle eine globale Client‐Instanz
|
||||
client = mqtt.Client(client_id=MQTT_CLIENT_ID)
|
||||
|
||||
Reference in New Issue
Block a user