Skip to content

Docker: allow passing the Home Assistant token in HA_TOKEN - #425

Open
LS80 wants to merge 1 commit into
MaxGramser:devfrom
LS80:ha-token-env
Open

LS80 wants to merge 1 commit into
MaxGramser:devfrom
LS80:ha-token-env

Conversation

@LS80

@LS80 LS80 commented Nov 15, 2026

Copy link
Copy Markdown

GitHub Issues are reviewed for bugs only. Feature requests, improvements and new board requests posted on GitHub will not be reviewed. Use the wishlist or its New boards category. Search first and upvote an existing wish. Questions go in Community.

Pull requests are for proposed code or documentation changes, not for submitting a request. A feature implementation can link to its website wish.

What changes

Container managers without Docker Compose secrets: (such as Unraid's Docker GUI) pass credentials as environment variables rather than file mounts. Mounting a single file is awkward in these UIs, and if the file does not exist yet on disk, Docker creates a directory in its place (IsADirectoryError). In Unraid, a container variable can be set to Display: Password so the token stays masked in the UI.

This change lets server.py read HA_TOKEN when SCREEN_DEV=1, falling back to HA_TOKEN_FILE as before. firmware.py (BUILD_ENV_NEVER) already strips any *TOKEN* variable from child build environments.

Related request

N/A (small standalone Docker improvement for Unraid / docker run setups).

Validation

  • Ran uv run --with aiohttp --with pyyaml --with jinja2 python3 -m unittest tests/test_shutdown.py tests/test_build_env.py tests/test_release_lint.py — passed (19 tests, including test_ha_token_env_starts_without_token_file in tests/test_shutdown.py).

  • This pull request targets dev.

  • I linked the related bug or website wish, when applicable.

  • I described relevant tests and limitations.

Container managers without Docker Compose file secrets (such as Unraid's
Docker UI) pass credentials as environment variables, and bind-mounting a
missing file path in Docker creates a directory in its place. In Unraid,
setting Display: Password on the variable masks the token in the UI.

Let SCREEN_DEV=1 read HA_TOKEN when set, falling back to HA_TOKEN_FILE as
before. firmware.py's BUILD_ENV_NEVER already strips any *TOKEN* variable
from child build environments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant