[PR #24304] [CLOSED] feat(ml): Offer environment variables to set the listener host and port #17810

Closed
opened 2026-02-05 16:27:54 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/24304
Author: @dionysius
Created: 12/1/2025
Status: Closed

Base: mainHead: machinelearningbindenvvariables


📝 Commits (1)

  • e7e0c38 feat(ml): Offer environment variables to set the listener host and port

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 machine-learning/immich_ml/config.py (+2 -2)

📄 Description

Description

The machine-learning server listens hard coded on 0.0.0.0 and port 3003. There are currently no options to define listener host or port. I propose to introduce environment variables MACHINE_LEARNING_HOST and MACHINE_LEARNING_PORT to offer such configuration. If those variables are not set, the previously existing default apply.

The environment variable names were chosen for consistency. All/Most ML specific environment variable start with MACHINE_LEARNING_, all/most main server specifics start with IMMICH_

This is useful for packaged builds and especially for installations on the same machine, where the machine-learning server can be set to localhost.

Any server should have a configuration to set the listener address.

No documentation has been modified as there is no mention needed for the official docker compose build (defaults stay the same). There are also other environment variables not documented which are also not relevant for the docker compose build.

There could be a documentation section for a complete list of available environment variables focused per service, but this is out of the scope for this PR.

I'm currently using this exact change as a patch in my downstream packaging.

Fixes no reported issue

How Has This Been Tested?

  • manually by setting and not setting the environment variables

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

I've used an LLM to suggest me the change as a shortcut since I'm not familiar with python. I've verified the changes manually.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/24304 **Author:** [@dionysius](https://github.com/dionysius) **Created:** 12/1/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `machinelearningbindenvvariables` --- ### 📝 Commits (1) - [`e7e0c38`](https://github.com/immich-app/immich/commit/e7e0c38a1d87affcbdefc01e3d48e8167329751b) feat(ml): Offer environment variables to set the listener host and port ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `machine-learning/immich_ml/config.py` (+2 -2) </details> ### 📄 Description ## Description The machine-learning server listens hard coded on 0.0.0.0 and port 3003. There are currently no options to define listener host or port. I propose to introduce environment variables `MACHINE_LEARNING_HOST` and `MACHINE_LEARNING_PORT` to offer such configuration. If those variables are not set, the previously existing default apply. The environment variable names were chosen for consistency. All/Most ML specific environment variable start with `MACHINE_LEARNING_`, all/most main server specifics start with `IMMICH_` This is useful for packaged builds and especially for installations on the same machine, where the machine-learning server can be set to localhost. Any server should have a configuration to set the listener address. No documentation has been modified as there is no mention needed for the official docker compose build (defaults stay the same). There are also other environment variables not documented which are also not relevant for the docker compose build. There could be a documentation section for a complete list of available environment variables focused per service, but this is out of the scope for this PR. I'm currently using this exact change as a patch in my downstream packaging. Fixes no reported issue ## How Has This Been Tested? - manually by setting and not setting the environment variables ## Checklist: - [x] I have performed a self-review of my own code - [x] I have made corresponding changes to the documentation if applicable - [x] I have no unrelated changes in the PR. - [ ] I have confirmed that any new dependencies are strictly necessary. - [ ] I have written tests for new code (if applicable) - [ ] I have followed naming conventions/patterns in the surrounding code - [ ] All code in `src/services/` uses repositories implementations for database calls, filesystem operations, etc. - [ ] All code in `src/repositories/` is pretty basic/simple and does not have any immich specific logic (that belongs in `src/services/`) ## Please describe to which degree, if any, an LLM was used in creating this pull request. I've used an LLM to suggest me the change as a shortcut since I'm not familiar with python. I've verified the changes manually. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 16:27:54 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#17810