diff --git a/Dockerfile b/Dockerfile index 50b1f73..a640599 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ FROM python:3.11 as base -ENV HEALTHCHECK_INTERVAL=5m \ - HEALTHCHECK_TIMEOUT=5s \ - SETTINGS_DIR=/config \ +ENV SETTINGS_DIR=/config \ SETTINGS_FILE=settings.yaml \ WORKDIR=/app @@ -40,9 +38,6 @@ FROM base as final RUN adduser plejd bluetooth -COPY ./config/$SETTINGS_FILE $SETTINGS_DIR/$SETTINGS_FILE -RUN chown plejd:plejd "$SETTINGS_DIR" - ENV PYTHONPATH="$WORKDIR/.venv/lib/python3.11/site-packages:${PYTHONPATH}" # Copy the built virtualenv deps from the builder stage @@ -54,7 +49,7 @@ RUN ./.venv/bin/pip install "$WORKDIR"/*.whl # Healthcheck COPY healthcheck.py $WORKDIR/healthcheck.py -HEALTHCHECK --interval=5m --timeout=1s \ +HEALTHCHECK --interval=1m --timeout=1s \ CMD python $WORKDIR/healthcheck.py --config $SETTINGS_DIR/$SETTINGS_FILE || exit 1 # Set the entrypoint diff --git a/README.md b/README.md index e6b84b3..ff8374c 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ Configuration of the application. See example configuration [here](#example). |------------------------------------------|--------------------------------------------------------|-------------| | `health_check` (Optional) | Enable health check | True | | `health_check_interval` (Optional) | Interval in seconds between writing health check files | 60.0 | -| `health_check_dir` (Optional) | Directory to store health check files | "/config" | +| `health_check_dir` (Optional) | Directory to store health check files | "~/.plejd/" | | `health_check_bt_file` (Optional) | File name for Bluetooth health check | "bluetooth" | | `health_check_mqtt_file` (Optional) | File name for MQTT health check | "mqtt" | | `health_check_heartbeat_file` (Optional) | File name for heartbeat file | "heartbeat" | diff --git a/plejd_mqtt_ha/mdl/settings.py b/plejd_mqtt_ha/mdl/settings.py index ce064cf..c0d0e66 100644 --- a/plejd_mqtt_ha/mdl/settings.py +++ b/plejd_mqtt_ha/mdl/settings.py @@ -18,6 +18,7 @@ """ +import os from typing import Optional from pydantic import BaseModel, validator @@ -99,7 +100,7 @@ class PlejdSettings(BaseModel): """Enable health check""" health_check_interval: float = 60.0 """Interval in seconds between writing health check files""" - health_check_dir: str = "/config/" # TODO: Does not belong here + health_check_dir: str = os.path.expanduser("~/.plejd/") """Directory to store health check files""" health_check_bt_file: str = "bluetooth" """File name for bluetooth health check"""