1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

refactor: node_env => immich_env (#9561)

This commit is contained in:
Jason Rasmussen 2024-05-17 13:30:05 -04:00 committed by GitHub
parent 2689178a35
commit 2e62c7b417
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 9 additions and 11 deletions

View File

@ -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 |

View File

@ -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" \

View File

@ -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" \

View File

@ -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"]

View File

@ -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)),

View File

@ -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';

View File

@ -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);
});