tillsteinbach / WeConnect-mqtt

MQTT Client that publishes data from Volkswagen WeConnect
MIT License
68 stars 13 forks source link

Bug: Dockerfile USER/PASSWORD parameters are mandatory - no way to use .netrc #309

Open ai91 opened 8 months ago

ai91 commented 8 months ago

Configuring secrets, but unfortunately it does work for MQTT connection only. User and password for weconnect are mandatory to be provided via environment variables in docker-compose.yml.

Starting with docker. When trying to omit USER/PASSWORD environment variables, the weconnect-mqtt fails with error message weconnect-mqtt: error: argument -u/--username: expected one argument

Configuration: docker-compose.yml

version: '3.3'

services:
  weconnect-mqtt:
    image: "tillsteinbach/weconnect-mqtt:latest"
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
      - LC_ALL=de_DE
      - BROKER_ADDRESS=192.168.1.200
      - ADDITIONAL_PARAMETERS=--netrc /run/secrets/weconnect_netrc
    secrets:
      - weconnect_netrc

secrets:
   weconnect_netrc:
     file: /root/secrets/weconnect_netrc

the netrc contains entries for volkswagen.de but they are not picked.

Workaround: The only solution to make it working, is provide USER/PASSWORD explicitly in docker-compose.yml:

version: '3.3'

services:
  weconnect-mqtt:
    image: "tillsteinbach/weconnect-mqtt:latest"
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
      - LC_ALL=de_DE
      - BROKER_ADDRESS=192.168.1.200
      - ADDITIONAL_PARAMETERS=--netrc /run/secrets/weconnect_netrc
      - USER=mysecretuser@example.com
      - PASSWORD=mysecretpassword
    secrets:
      - weconnect_netrc

secrets:
   weconnect_netrc:
     file: /root/secrets/weconnect_netrc

TODO: make user/password paramethers optional, to allow pick values from netrc secret.