fix(web): use env for web folder path (#5753)

* fix: use env for web folder path

* feat: use constant

* fix: use join

* update docs

* fix: icon
This commit is contained in:
martin
2023-12-16 18:15:30 +01:00
committed by GitHub
parent cb1201e690
commit 2f95cb89c1
6 changed files with 16 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
import { AssetType } from '@app/infra/entities';
import { Duration } from 'luxon';
import { extname } from 'node:path';
import { extname, join } from 'node:path';
import pkg from 'src/../../package.json';
export const AUDIT_LOG_MAX_DURATION = Duration.fromObject({ days: 100 });
@@ -58,6 +58,8 @@ export const serverVersion = ServerVersion.fromString(pkg.version);
export const APP_MEDIA_LOCATION = process.env.IMMICH_MEDIA_LOCATION || './upload';
export const WEB_ROOT_PATH = join(process.env.IMMICH_WEB_ROOT || '/usr/src/app/www', 'index.html');
const image: Record<string, string[]> = {
'.3fr': ['image/3fr', 'image/x-hasselblad-3fr'],
'.ari': ['image/ari', 'image/x-arriflex-ari'],

View File

@@ -7,6 +7,7 @@ import {
SharedLinkService,
StorageService,
SystemConfigService,
WEB_ROOT_PATH,
} from '@app/domain';
import { ImmichLogger } from '@app/infra/logger';
import { Injectable } from '@nestjs/common';
@@ -67,7 +68,7 @@ export class AppService {
ssr(excludePaths: string[]) {
let index = '';
try {
index = readFileSync('/usr/src/app/www/index.html').toString();
index = readFileSync(WEB_ROOT_PATH).toString();
} catch (error: Error | any) {
this.logger.warn('Unable to open `www/index.html, skipping SSR.');
}