bropat / eufy-security-ws

Small server wrapper around eufy-security-client library to access it via a WebSocket.
MIT License
165 stars 24 forks source link

Support docker secrets for username and password #309

Closed DennisGaida closed 4 months ago

DennisGaida commented 4 months ago

I don't like confidential data just hanging around in environment variables, especially for security related products. That's what docker secrets were made for to make things a bit better.

With this PR you can use docker secrets to set the USERNAME and PASSWORD using USERNAME_FILE and PASSWORD_FILE respectively. The files just contain the plaintext username or password. The traditional way of just using USERNAME and/or PASSWORD still works.

A full docker compose example:

docker-compose.yml

secrets:
  eufy-security-ws_password:
    file: <secretsmount>/eufy-security-ws_password
  eufy-security-ws_username:
    file: <secretsmount>/eufy-security-ws_username

services:
  eufy-security-ws:
    image: bropat/eufy-security-ws:latest
    container_name: eufy-security-ws
    network_mode: host
    volumes:
      - ./data:/data
    environment:
      USERNAME_FILE: /run/secrets/eufy-security-ws_username
      PASSWORD_FILE: /run/secrets/eufy-security-ws_password
    secrets:
      - eufy-security-ws_username
      - eufy-security-ws_password

$ cat eufy-security-ws_username as an example

emailaddress@example.com