Passing add-on config data to Docker image as env var on start

Title pretty much says it all. I’m trying to use a 3rd party image hosted at Docker hub in my add-on. However, the 3rd party image requires a variable to be passed through (in this case a commercial key) and per their documentation, one is to use
docker run -e "KEY=$KEY" vendor/image
to get the image up and running. Indeed, I’ve verified this works on a separate box, and I’ve even got the hass.io local add-on showing logs that reflect that it is failing specifically due to not having this KEY environmental variable at boot.

Anyone know of any good ways to get that in there? My wall has a bit of a dent from where I’ve been banging my head against it…

I have the same question, my issue is BitWardenRS Yubikey which requires me to set the Env variables. It is not clear to me how details set in the Configuration for a Home Assistant Add-ons are passed to the Docker instance as variables.

Portainer shows me what I need but I feel this is the wrong place to make the changes as the intent is to use Add-ons.

Is there a valid syntax to support this use case in the Add-ons Configuration?

Like James I have a saw head now, the wall is hard. I have spent 4 hours on this so far so time to reach out. Thanks in advance for any tips.

Hah, me too! I just found this thread after purchasing a yubikey to try it out. I’m trying to set up my bitwarden to use the yubikey and I found this: Enabling Yubikey OTP authentication · dani-garcia/vaultwarden Wiki · GitHub which describes modifying the environment variables passed to the docker container:

docker run -d --name bitwarden \
  -e YUBICO_CLIENT_ID=12345 \
  -e YUBICO_SECRET_KEY=ABCDEABCDEABCDEABCDE= \
  -v /vw-data/:/data/ \
  -p 80:80 \
  vaultwarden/server:latest

but the Configuration tab of the bitwarden add-on doesn’t have any of these options. :confused:

If you want to pass config data as environment options, use legacy from this list. Add-On Configuration | Home Assistant Developer Docs