immich

environment and configuration, read statically · 2026-12-04 11:28 · 2685 source files, 118 variables read, 149 declared
2 things would stop this running somewhere else.

4 more would fail quietly.. 2 are worth tidying..

What it needs before it starts

Set these and the program has what it asks for. Anything not listed has a default in the code.
variablewhydeclared forfirst read at
IMMICH_MEDIA_LOCATIONthe read raises when unset— — nowhereserver/src/commands/media-location.command.ts:80
IMMICH_PLUGINS_INSTALL_FOLDERthe read raises when unset— — nowhereserver/src/dtos/env.dto.ts:56
DB_DATA_LOCATIONsubstituted into docker/docker-compose.yml with no defaultexampledocker/docker-compose.yml
UPLOAD_LOCATIONsubstituted into docker/docker-compose.yml with no defaultexampledocker/docker-compose.yml
2 more are read with no fallback — empty if you do not set them
These do not stop anything. The read evaluates to nothing and whatever depends on it is inactive, which is why this class of problem survives into production.
variabledeclared forread at
BUILD_STATS— — nowhereweb/vite.config.ts:172
DEVICEbuild, ci, local, prodmachine-learning/immich_ml/config.py:49

Stops the program blocker

Read in a form that raises when the value is absent, and declared nowhere in this repository.

IMMICH_MEDIA_LOCATION is required and declared nowhere

The code stops when it is absent - it is read in a form that raises rather than falls back - and no env file, compose file, workflow or manifest in this repository sets it. A clean checkout cannot start.

fix
Add IMMICH_MEDIA_LOCATION to the example env file so the next person knows it exists, and to whichever surface actually runs this.
server/src/dtos/env.dto.ts:53

IMMICH_PLUGINS_INSTALL_FOLDER is required and declared nowhere

The code stops when it is absent - it is read in a form that raises rather than falls back - and no env file, compose file, workflow or manifest in this repository sets it. A clean checkout cannot start.

fix
Add IMMICH_PLUGINS_INSTALL_FOLDER to the example env file so the next person knows it exists, and to whichever surface actually runs this.
server/src/dtos/env.dto.ts:56

Silently empty risk

Read with no fallback and declared nowhere. Nothing raises; the feature is simply off.

BUILD_STATS is read with no fallback and declared nowhere

Nothing raises: the value is simply empty, so whatever depends on it is quietly inactive. This is the shape of bug that reaches production, because the process starts and the tests pass.

fix
Either declare BUILD_STATS, or give the read an explicit default so the behaviour when it is unset is written down.
web/vite.config.ts:172

Missing from the example file risk

Read with no fallback, and absent from the file that tells a new developer what to set.

DB_HOSTNAME is read with no fallback, and docker/example.env does not mention it

It is declared for local and nowhere else, so the documented setup path is incomplete: someone configuring this from the example file never learns the variable exists, and whatever it controls is quietly inactive for them.

fix
Add DB_HOSTNAME to docker/example.env, with a comment saying what it is for.
server/src/bin/sync-sql.ts:77, server/src/bin/sync-sql.ts:78, server/src/dtos/env.dto.ts:74

DEVICE is read with no fallback, and docker/example.env does not mention it

It is declared for build, ci, local, prod and nowhere else, so the documented setup path is incomplete: someone configuring this from the example file never learns the variable exists, and whatever it controls is quietly inactive for them.

fix
Add DEVICE to docker/example.env, with a comment saying what it is for.
machine-learning/immich_ml/config.py:49

IMMICH_SOURCE_REF is read with no fallback, and docker/example.env does not mention it

It is declared for build, local and nowhere else, so the documented setup path is incomplete: someone configuring this from the example file never learns the variable exists, and whatever it controls is quietly inactive for them.

fix
Add IMMICH_SOURCE_REF to docker/example.env, with a comment saying what it is for.
machine-learning/immich_ml/__main__.py:9, server/src/dtos/env.dto.ts:60

Two different defaults note

The program behaves differently depending on how it was started.

IMMICH_SERVER_URL defaults to 'http://immich-server:2283/' in code and 'http://immich-server:2285/' in e2e/docker-compose.dev.yml

The program behaves one way when it is started directly and another way when it is started through that file. Whichever is right, one of them is a surprise waiting for whoever changes the other.

fix
Pick one, and let the other side read it rather than restate it.
e2e/docker-compose.dev.yml:50, web/vite.config.ts:107

Declared, read by nothing note

Setting it has no effect, which is worse than useless: it reads as a working control.

API_KEY_ISSUER_ID is declared but nothing reads it

Declared for ci. No read of this name appears anywhere in the source, so setting it has no effect - which is worse than useless, because it reads as a working control.

fix
Delete it, or say in a comment what reads it, if something outside this repository does.
.github/workflows/build-mobile.yml:319

Where each required variable is declared

One column per place this repository configures itself. A gap in a column is a way of running it that is missing a value.
variableexamplelocalciprodbuild
IMMICH_MEDIA_LOCATIONnonononono
IMMICH_PLUGINS_INSTALL_FOLDERnonononono
DB_DATA_LOCATIONyesnononono
UPLOAD_LOCATIONyesnononono
BUILD_STATSnonononono
DEVICEnoyesyesyesyes
84 optional settings, with the default the code falls back to
variabledefaultdeclared forread at
APP_STORE_CONNECT_API_KEY_ID—cimobile/ios/fastlane/Fastfile:29
APP_STORE_CONNECT_API_KEY_ISSUER_ID—cimobile/ios/fastlane/Fastfile:30
CPU_CORES——server/bin/start.sh:46
DB_DATABASE_NAME—example, localserver/src/dtos/env.dto.ts:73
DB_HOSTNAME—localserver/src/bin/sync-sql.ts:77
DB_PASSWORD—example, localserver/src/dtos/env.dto.ts:75
DB_PORT——server/src/dtos/env.dto.ts:76
DB_SKIP_MIGRATIONS——server/src/dtos/env.dto.ts:77
DB_SSL_MODE——server/src/dtos/env.dto.ts:78
DB_USERNAME—example, localserver/src/dtos/env.dto.ts:80
DB_VECTOR_EXTENSION——server/src/dtos/env.dto.ts:81
DEV_PORT——.devcontainer/server/container-common.sh:3
DEV_SERVER_PORT——.devcontainer/server/container-common.sh:2
EnableDirectSubmission0—machine-learning/immich_ml/__main__.py:19
IMMICH_ALLOW_EXTERNAL_PLUGINS——server/src/dtos/env.dto.ts:55
IMMICH_ALLOW_SETUP——server/src/dtos/env.dto.ts:69
IMMICH_API_METRICS_PORT——server/src/dtos/env.dto.ts:39
IMMICH_BUILD—build, localweb/vite.config.ts:153
IMMICH_BUILD_DATA——server/src/dtos/env.dto.ts:40
IMMICH_BUILD_IMAGE—build, localserver/src/dtos/env.dto.ts:43
IMMICH_BUILD_IMAGE_URL—build, localserver/src/dtos/env.dto.ts:44
IMMICH_BUILD_URL—build, localserver/src/dtos/env.dto.ts:42
IMMICH_CONFIG_FILE——server/src/dtos/env.dto.ts:45
IMMICH_CONFIG_LOGGING_LEVEL——server/src/main.ts:165
IMMICH_ENV—build, localserver/src/dtos/env.dto.ts:48
IMMICH_HELMET_FILE——server/src/dtos/env.dto.ts:47
IMMICH_HOST——machine-learning/immich_ml/config.py:94
IMMICH_IGNORE_MOUNT_CHECK_ERRORS—localserver/src/dtos/env.dto.ts:50
IMMICH_LOG_FORMAT——server/src/dtos/env.dto.ts:52
IMMICH_LOG_LEVEL——machine-learning/immich_ml/config.py:96
IMMICH_MICROSERVICES_METRICS_PORT——server/src/dtos/env.dto.ts:54
IMMICH_PORT—localmachine-learning/immich_ml/config.py:95
IMMICH_PROCESS_INVALID_IMAGES——server/src/services/media.service.ts:275
IMMICH_REPOSITORY—build, localserver/src/dtos/env.dto.ts:58
IMMICH_REPOSITORY_URL—build, localserver/src/dtos/env.dto.ts:59
IMMICH_SERVER_URLhttp://immich-server:2283/localweb/vite.config.ts:107
IMMICH_SOURCE_COMMIT—build, localserver/src/dtos/env.dto.ts:61
IMMICH_SOURCE_REF—build, localmachine-learning/immich_ml/__main__.py:9
IMMICH_SOURCE_URL—build, localserver/src/dtos/env.dto.ts:62
IMMICH_TELEMETRY_EXCLUDE——server/src/dtos/env.dto.ts:64
IMMICH_TELEMETRY_INCLUDE—localserver/src/dtos/env.dto.ts:63
IMMICH_THIRD_PARTY_BUG_FEATURE_URL—localserver/src/dtos/env.dto.ts:66
IMMICH_THIRD_PARTY_DOCUMENTATION_URL—localserver/src/dtos/env.dto.ts:67
IMMICH_THIRD_PARTY_SOURCE_URL—localserver/src/dtos/env.dto.ts:65
IMMICH_THIRD_PARTY_SUPPORT_URL—localserver/src/dtos/env.dto.ts:68
IMMICH_TRUSTED_PROXIES——server/src/dtos/env.dto.ts:70
IMMICH_WORKERS_EXCLUDE——server/src/dtos/env.dto.ts:72
IMMICH_WORKERS_INCLUDE——server/src/dtos/env.dto.ts:71
MACHINE_LEARNING_ANN——machine-learning/immich_ml/config.py:72
MACHINE_LEARNING_ANN_FP16_TURBO——machine-learning/immich_ml/config.py:73
MACHINE_LEARNING_ANN_TUNING_LEVEL——machine-learning/immich_ml/config.py:74
MACHINE_LEARNING_CACHE_FOLDER——machine-learning/immich_ml/config.py:60
MACHINE_LEARNING_DEVICE_ID0—machine-learning/immich_ml/config.py:88
MACHINE_LEARNING_DEVICE_IDS0—machine-learning/immich_ml/gunicorn_conf.py:8
MACHINE_LEARNING_HTTP_KEEPALIVE_TIMEOUT_S——machine-learning/immich_ml/config.py:65
MACHINE_LEARNING_MAX_BATCH_SIZE——machine-learning/immich_ml/config.py:78
MACHINE_LEARNING_MODEL_ARENA—buildmachine-learning/immich_ml/config.py:71
MACHINE_LEARNING_MODEL_INTER_OP_THREADS——machine-learning/immich_ml/config.py:69
MACHINE_LEARNING_MODEL_INTRA_OP_THREADS——machine-learning/immich_ml/config.py:70
MACHINE_LEARNING_MODEL_ORGANIZATION——machine-learning/immich_ml/config.py:79
MACHINE_LEARNING_MODEL_REVISION——machine-learning/immich_ml/config.py:80
MACHINE_LEARNING_MODEL_TTL——machine-learning/immich_ml/config.py:61
MACHINE_LEARNING_MODEL_TTL_POLL_S——machine-learning/immich_ml/config.py:62
MACHINE_LEARNING_PRELOAD——machine-learning/immich_ml/config.py:77
MACHINE_LEARNING_REQUEST_THREADS——machine-learning/immich_ml/config.py:68
MACHINE_LEARNING_RKNN——machine-learning/immich_ml/config.py:75
MACHINE_LEARNING_RKNN_THREADS——machine-learning/immich_ml/config.py:76
MACHINE_LEARNING_TEST_FULL——machine-learning/immich_ml/config.py:66
MACHINE_LEARNING_TEST_PROVIDER—cimachine-learning/immich_ml/config.py:67
MACHINE_LEARNING_WORKERS——machine-learning/immich_ml/config.py:63
MACHINE_LEARNING_WORKER_TIMEOUT——machine-learning/immich_ml/config.py:64
MIMALLOC_PURGE_DELAY——server/bin/start.sh:22
NEOReadDebugKeys1—machine-learning/immich_ml/__main__.py:18
ORT_DISABLE_TELEMETRY1—machine-learning/immich_ml/__init__.py:3
PUBLIC_IMMICH_BUY_HOSThttps://buy.immich.app—web/vite.config.ts:122
PUBLIC_IMMICH_PAY_HOSThttps://pay.futo.org—web/vite.config.ts:123
REDIS_DBINDEX——server/src/dtos/env.dto.ts:85
REDIS_HOSTNAME——server/src/dtos/env.dto.ts:83
REDIS_PORT——server/src/dtos/env.dto.ts:84
REDIS_SOCKET——server/src/dtos/env.dto.ts:88
REDIS_USERNAME——server/src/dtos/env.dto.ts:86
SVELTE_ESLINT_PARSER_EXPERIMENTAL_TS_SYS_HOOK——web/lint-env.js:5
period——server/bin/get-cpus.sh:40
quota——server/bin/get-cpus.sh:40

What this report could not see

Stated plainly, because a configuration report that hides its blind spots is worse than none.
4 reads use a name the tool cannot seeThe variable is looked up through a value computed at runtime, so its name is not in the source. Those variables cannot appear in any list here, and the declared-but-unread list below may name one of them. Nothing else in the report is affected.
a compose service loads an env file wholesaleVariables arriving through `env_file:` are whatever that file contains at run time. Files loaded this way: docker/.env.

More measured notes on coding agents: alexenabled.github.io