From 2f95cb89c1f13614fdc5bcb94a2ab51f87f1a33a Mon Sep 17 00:00:00 2001 From: martin <74269598+martabal@users.noreply.github.com> Date: Sat, 16 Dec 2023 18:15:30 +0100 Subject: [PATCH] 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 --- docs/docs/install/environment-variables.md | 17 +++++++++-------- docs/src/pages/milestones.tsx | 2 +- server/src/domain/domain.constant.ts | 4 +++- server/src/immich/app.service.ts | 3 ++- web/src/app.html | 2 +- web/static/favicon.ico | Bin 1406 -> 1150 bytes 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/docs/install/environment-variables.md b/docs/docs/install/environment-variables.md index 2972f5fb38..20966cfd14 100644 --- a/docs/docs/install/environment-variables.md +++ b/docs/docs/install/environment-variables.md @@ -30,14 +30,15 @@ These environment variables are used by the `docker-compose.yml` file and do **N ## General -| Variable | Description | Default | Services | -| :-------------------------- | :------------------------------------------- | :----------: | :------------------------------------------- | -| `TZ` | Timezone | | microservices | -| `NODE_ENV` | Environment (production, development) | `production` | server, microservices, machine learning, web | -| `LOG_LEVEL` | Log Level (verbose, debug, log, warn, error) | `log` | server, microservices | -| `IMMICH_MEDIA_LOCATION` | Media Location | `./upload` | server, microservices | -| `PUBLIC_LOGIN_PAGE_MESSAGE` | Public Login Page Message | | web | -| `IMMICH_CONFIG_FILE` | Path to config file | | server | +| Variable | Description | Default | Services | +| :-------------------------- | :------------------------------------------- | :-----------------: | :------------------------------------------- | +| `TZ` | Timezone | | microservices | +| `NODE_ENV` | Environment (production, development) | `production` | server, microservices, machine learning, web | +| `LOG_LEVEL` | Log Level (verbose, debug, log, warn, error) | `log` | server, microservices | +| `IMMICH_MEDIA_LOCATION` | Media Location | `./upload` | server, microservices | +| `PUBLIC_LOGIN_PAGE_MESSAGE` | Public Login Page Message | | web | +| `IMMICH_CONFIG_FILE` | Path to config file | | server | +| `IMMICH_WEB_ROOT` | Path of root index.html | `/usr/src/app/www'` | server | :::tip diff --git a/docs/src/pages/milestones.tsx b/docs/src/pages/milestones.tsx index e7857ffecf..def90f0fa7 100644 --- a/docs/src/pages/milestones.tsx +++ b/docs/src/pages/milestones.tsx @@ -60,7 +60,7 @@ const items: Item[] = [ title: 'Search improvement with pgvecto.rs', release: 'v1.91.0', tag: 'v1.91.0', - date: new Date(2023, 11, 7), + date: new Date(2023, 11, 15), dateType: DateType.RELEASE, }, { diff --git a/server/src/domain/domain.constant.ts b/server/src/domain/domain.constant.ts index a4c17ff2df..a6ac96ba74 100644 --- a/server/src/domain/domain.constant.ts +++ b/server/src/domain/domain.constant.ts @@ -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 = { '.3fr': ['image/3fr', 'image/x-hasselblad-3fr'], '.ari': ['image/ari', 'image/x-arriflex-ari'], diff --git a/server/src/immich/app.service.ts b/server/src/immich/app.service.ts index bc67e32048..79da7b2bed 100644 --- a/server/src/immich/app.service.ts +++ b/server/src/immich/app.service.ts @@ -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.'); } diff --git a/web/src/app.html b/web/src/app.html index e64d2985ab..50f1b31095 100644 --- a/web/src/app.html +++ b/web/src/app.html @@ -6,7 +6,7 @@ - + diff --git a/web/static/favicon.ico b/web/static/favicon.ico index 8acbbb4fb304e67663fa734fcc4a2a89ace59487..7b4600ac70680bc6fd0b003e020f43a4b35cc822 100644 GIT binary patch literal 1150 zcmbW1Yitx%6vxNJeljs6MrxuT{Agk2;TLQ+G}pf>RVF&YF7k6?;`rBaF5 zRu_W7D1^eo^Z{|(?SroEma?^vbS>Q$jY5~~GIV!g+u2ulcRK9+yff{ZhL6tVfA5)d z?*E+o_}`JFhs3*VnIzh$rH>z$q~($%JtH7o!n5EPog|6aV~;Gr`W6ka6b0hD%*Z6< zTs)#+kABwQb_Cdk6iu zI@OGxwh4aW133zfG2j}&L_z`TKyh-kX2 zHc0E2etxYB)BjtDP}5%e?C&#py_ugTGQ3`!WLtHNcAtkAu11hLu;w(8M2}5tdiS>h z+79?})P)##xJlHMkg~l)w6_mubDZ+GBNUf}`Oz`XN{`@o!t!45#?dozUAb~Xp>_Wh zZ8br9nr@&r*APBgO~36QI_nj7?~JgoCQQ9&h{t=f7Qbi!Zf6i0L!NL(Exz-hSi`X} zE_aN{@fmvSf)+-{QaEpVC>!)6bqVo_`rH0QP{rPhGnfr#)$XGK9Q&qleHY;Lg#=aZ zc^U`O7OLGERn9n1xeaUWPq^WCmHhb?h(tEUm&Dr?;YzDY*;^4_-VkQ(2lp(P_B!GF zdO&B>IM}DH+Ijt$`Zx7#YLcPREH9RXC|Z4o6^k%!(>E+)i_cR1{&#;w%$Axn)Klk^ zY}pZ|yyC8f4~2cop2UoqV+0<&KUR)hZb8o?E+>*XWjcIcH(}bQPoQjZOulCRH}Jpv Fe*x@g8N$)shvdR(zT^kI&PsS#@DPo|(3IW!T}BwGi)%j%>Q*gm3O= z?9OqMda_;qMw zzu;lCH{FSw>B!oLHhnLrg?d8rdI*sX5h@$xY`TVX5=j?&$qjEsi0Ys)x{b?G3a%b+ z;p&MNiX$WYlB_%AW%p1lQH+3{$@1U{1n;Nyqtsap^jmW**8rteLv@3>Dwdqi3?(wj{lXjhm zp}P%r`yjo_K@7c}XtYN9`Xz=m7zZ@ydWX^JwGsn}gIbJ31LzGy=#3(xeu!a%9&uQY z!Dzr}Fd~lJqSTZ4KOWBkVIs0@uLf0m~8gFG;5#J-p$iyyfu5f!<0qR z%##NKqraRw{mq&0h0U}2I`gcT?V5uhe;B%L?%O-wFrOWl=xMv^8>eN5Hazu&+Z^** zv8e&JE7$Md<-dB8#g