Skip to content

feat(config): support Docker secrets via API_KEY_FILE - #74

Merged
Majorfi merged 1 commit into
mainfrom
feat/issue-73-docker-secrets
Jul 22, 2026
Merged

feat(config): support Docker secrets via API_KEY_FILE#74
Majorfi merged 1 commit into
mainfrom
feat/issue-73-docker-secrets

Conversation

@Majorfi

@Majorfi Majorfi commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Closes #73

What

API_KEY_FILE points to a file whose content becomes the API key(s), following the _FILE convention of official Docker images:

environment:
  - API_KEY_FILE=/run/secrets/immich_api_key
secrets:
  - immich_api_key

Behavior

  • The file content is trimmed — secret files usually end with a trailing newline.
  • The same comma-separated multi-key format as API_KEY is supported, so multi-user setups work unchanged.
  • API_KEY (or --api-key) and API_KEY_FILE are mutually exclusive: setting both is a startup error, so there is never an ambiguity about which key is in use. A missing or unreadable file is also a clear startup error.

Docs

The integration docs recommended Docker secrets as a best practice without the tool being able to consume them. The environment-variables reference now documents API_KEY_FILE, the Docker page links the recommendation to it, and the compose page gains a working secrets example.

Testing

Table-driven tests cover: plain file, trailing newline, comma-separated keys, missing file, both variables set, and empty file. go test -race ./... green.

API_KEY_FILE points to a file whose content becomes the API key(s),
following the _FILE convention of official Docker images — e.g.
API_KEY_FILE=/run/secrets/immich_api_key with a Swarm or compose
secret. The content is trimmed (secret files usually end with a
newline) and supports the same comma-separated multi-key format as
API_KEY. Setting both API_KEY and API_KEY_FILE is an error so there is
never an ambiguity about which key is in use.

The docs already recommended Docker secrets as a best practice without
the tool being able to consume them; the integration pages now show
how.

Closes #73
@Majorfi
Majorfi merged commit 2ac6934 into main Jul 22, 2026
1 check passed
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.

Add support for docker secrets

1 participant