Skip to content

High performance self-hosted photo and video management solution.

refactor: node_env => immich_env (#9561)

Jason Rasmussen2e62c7b4170b
diff --git a/docs/docs/install/environment-variables.md b/docs/docs/install/environment-variables.md
index 4c163ac226..a3c08f2c70 100644
--- a/docs/docs/install/environment-variables.md
+++ b/docs/docs/install/environment-variables.md
@@ -41,7 +41,7 @@ Regardless of filesystem, it is not recommended to use a network share for your
| Variable | Description | Default | Services |
| :------------------------------ | :------------------------------------------- | :----------------------: | :-------------------------------------- |
| `TZ` | Timezone | | microservices |
-| `NODE_ENV` | Environment (production, development) | `production` | server, microservices, machine learning |
+| `IMMICH_ENV` | Environment (production, development) | `production` | server, microservices, machine learning |
| `IMMICH_LOG_LEVEL` | Log Level (verbose, debug, log, warn, error) | `log` | server, microservices, machine learning |
| `IMMICH_MEDIA_LOCATION` | Media Location | `./upload`<sup>\*1</sup> | server, microservices |
| `IMMICH_CONFIG_FILE` | Path to config file | | server, microservices |
diff --git a/machine-learning/Dockerfile b/machine-learning/Dockerfile
index 001bba2b63..cd1f2b2d99 100644
--- a/machine-learning/Dockerfile
+++ b/machine-learning/Dockerfile
@@ -74,8 +74,7 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
-ENV NODE_ENV=production \
- TRANSFORMERS_CACHE=/cache \
+ENV TRANSFORMERS_CACHE=/cache \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/opt/venv/bin:$PATH" \
diff --git a/machine-learning/export/Dockerfile b/machine-learning/export/Dockerfile
index 26584c68a3..cbd1b418ef 100644
--- a/machine-learning/export/Dockerfile
+++ b/machine-learning/export/Dockerfile
@@ -1,7 +1,6 @@
FROM mambaorg/micromamba:bookworm-slim@sha256:abcb3ae7e3521d08e1fdeaff63131765b34e4f29b6a8a2c28660036b53841569 as builder
-ENV NODE_ENV=production \
- TRANSFORMERS_CACHE=/cache \
+ENV TRANSFORMERS_CACHE=/cache \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/opt/venv/bin:$PATH" \
diff --git a/server/Dockerfile b/server/Dockerfile
index 8acdf91d05..d31ed90ad6 100644
--- a/server/Dockerfile
+++ b/server/Dockerfile
@@ -11,7 +11,7 @@ RUN npm ci && \
rm -rf node_modules/@img/sharp-linuxmusl-x64
COPY server .
ENV PATH="${PATH}:/usr/src/app/bin" \
- NODE_ENV=development \
+ IMMICH_ENV=development \
NVIDIA_DRIVER_CAPABILITIES=all \
NVIDIA_VISIBLE_DEVICES=all
ENTRYPOINT ["tini", "--", "/bin/sh"]
diff --git a/server/src/config.ts b/server/src/config.ts
index 3e3a42c760..0f8a645005 100644
--- a/server/src/config.ts
+++ b/server/src/config.ts
@@ -360,7 +360,7 @@ export const immichAppConfig: ConfigModuleOptions = {
envFilePath: '.env',
isGlobal: true,
validationSchema: Joi.object({
- NODE_ENV: Joi.string().optional().valid('development', 'production', 'staging').default('development'),
+ IMMICH_ENV: Joi.string().optional().valid('development', 'production').default('production'),
IMMICH_LOG_LEVEL: Joi.string()
.optional()
.valid(...Object.values(LogLevel)),
diff --git a/server/src/constants.ts b/server/src/constants.ts
index 937dcf373a..41759c2763 100644
--- a/server/src/constants.ts
+++ b/server/src/constants.ts
@@ -16,8 +16,8 @@ export const serverVersion = Version.fromString(version);
export const AUDIT_LOG_MAX_DURATION = Duration.fromObject({ days: 100 });
export const ONE_HOUR = Duration.fromObject({ hours: 1 });
-export const envName = (process.env.NODE_ENV || 'development').toUpperCase();
-export const isDev = () => process.env.NODE_ENV === 'development';
+export const envName = (process.env.IMMICH_ENV || 'production').toUpperCase();
+export const isDev = () => process.env.IMMICH_ENV === 'development';
export const APP_MEDIA_LOCATION = process.env.IMMICH_MEDIA_LOCATION || './upload';
export const WEB_ROOT = process.env.IMMICH_WEB_ROOT || '/usr/src/app/www';
diff --git a/server/src/services/version.service.spec.ts b/server/src/services/version.service.spec.ts
index 35bb260628..e6a2284b1a 100644
--- a/server/src/services/version.service.spec.ts
+++ b/server/src/services/version.service.spec.ts
@@ -61,11 +61,11 @@ describe(VersionService.name, () => {
describe('handVersionCheck', () => {
beforeEach(() => {
- process.env.NODE_ENV = 'production';
+ process.env.IMMICH_ENV = 'production';
});
it('should not run in dev mode', async () => {
- process.env.NODE_ENV = 'development';
+ process.env.IMMICH_ENV = 'development';
await expect(sut.handleVersionCheck()).resolves.toEqual(JobStatus.SKIPPED);
});