use correct broker setting

This commit is contained in:
2025-11-08 15:56:03 +01:00
parent 6bf8ac3f99
commit 6271f46019
5 changed files with 9 additions and 13 deletions

View File

@@ -32,7 +32,7 @@ docker build -t abstraction:dev -f apps/abstraction/Dockerfile .
```bash
docker run --rm \
-v $(pwd)/config:/app/config:ro \
-e MQTT_BROKER=172.16.2.16 \
-e MQTT_BROKER=172.23.1.102 \
-e MQTT_PORT=1883 \
-e REDIS_HOST=172.23.1.116 \
-e REDIS_PORT=6379 \

View File

@@ -38,8 +38,8 @@ def load_config(config_path: Path) -> dict[str, Any]:
logger.warning(f"Config file not found: {config_path}, using defaults")
return {
"mqtt": {
"broker": "172.16.2.16",
"port": 1883,
"broker": os.getenv("MQTT_BROKER", "localhost"),
"port": int(os.getenv("MQTT_PORT", "1883")),
"client_id": "home-automation-abstraction",
"keepalive": 60
},
@@ -227,8 +227,8 @@ async def mqtt_worker(config: dict[str, Any], redis_client: aioredis.Redis) -> N
redis_client: Redis client for UI updates
"""
mqtt_config = config.get("mqtt", {})
broker = mqtt_config.get("broker", "172.16.2.16")
port = mqtt_config.get("port", 1883)
broker = os.getenv("MQTT_BROKER") or mqtt_config.get("broker", "localhost")
port = int(os.getenv("MQTT_PORT", mqtt_config.get("port", 1883)))
client_id = mqtt_config.get("client_id", "home-automation-abstraction")
# Append a short suffix (ENV override possible) so multiple processes don't collide
client_suffix = os.environ.get("MQTT_CLIENT_ID_SUFFIX") or uuid.uuid4().hex[:6]

View File

@@ -42,7 +42,7 @@ docker build -t api:dev -f apps/api/Dockerfile .
```bash
docker run --rm -p 8001:8001 \
-v $(pwd)/config:/app/config:ro \
-e MQTT_BROKER=172.16.2.16 \
-e MQTT_BROKER=172.23.1.102 \
-e MQTT_PORT=1883 \
-e REDIS_HOST=172.23.1.116 \
-e REDIS_PORT=6379 \

View File

@@ -53,7 +53,7 @@ docker build -t simulator:dev -f apps/simulator/Dockerfile .
```bash
docker run --rm -p 8010:8010 \
-e MQTT_BROKER=172.16.2.16 \
-e MQTT_BROKER=172.23.1.102 \
-e MQTT_PORT=1883 \
-e SIM_PORT=8010 \
simulator:dev
@@ -61,11 +61,9 @@ docker run --rm -p 8010:8010 \
**Mit Docker Network (optional):**
```bash
docker network create home-automation
docker run --rm -p 8010:8010 \
--network home-automation \
--name simulator \
-e MQTT_BROKER=172.16.2.16 \
-e MQTT_BROKER=172.23.1.102 \
simulator:dev
```

View File

@@ -40,11 +40,9 @@ docker build -t ui:dev -f apps/ui/Dockerfile .
**Linux Server (empfohlen):**
```bash
# Mit Docker Network für Container-to-Container Kommunikation
docker network create home-automation
docker run --rm -p 8002:8002 \
--network home-automation \
-e UI_PORT=8002 \
-e API_BASE=http://api:8001 \
-e API_BASE=http://172.19.1.11:8001 \
-e BASE_PATH=/ \
ui:dev
```