From 12cf1167987257f4b45be2473da78c8a73905e22 Mon Sep 17 00:00:00 2001 From: martin <74269598+martabal@users.noreply.github.com> Date: Wed, 29 May 2024 19:06:49 +0200 Subject: [PATCH] fix: immich port with external domain (#9856) * fix: immich port with external domain * rename variable --- server/src/constants.ts | 2 ++ server/src/services/notification.service.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/src/constants.ts b/server/src/constants.ts index e5ab35a11ed..4e2aca7184f 100644 --- a/server/src/constants.ts +++ b/server/src/constants.ts @@ -24,6 +24,8 @@ 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'; +const HOST_SERVER_PORT = process.env.IMMICH_PORT || '2283'; +export const DEFAULT_EXTERNAL_DOMAIN = 'http://localhost:' + HOST_SERVER_PORT; const GEODATA_ROOT_PATH = process.env.IMMICH_REVERSE_GEOCODING_ROOT || '/usr/src/resources'; diff --git a/server/src/services/notification.service.ts b/server/src/services/notification.service.ts index fb7853bb049..ddd8d61e3df 100644 --- a/server/src/services/notification.service.ts +++ b/server/src/services/notification.service.ts @@ -1,4 +1,5 @@ import { Inject, Injectable } from '@nestjs/common'; +import { DEFAULT_EXTERNAL_DOMAIN } from 'src/constants'; import { SystemConfigCore } from 'src/cores/system-config.core'; import { OnServerEvent } from 'src/decorators'; import { AlbumEntity } from 'src/entities/album.entity'; @@ -63,7 +64,7 @@ export class NotificationService { const { html, text } = this.notificationRepository.renderEmail({ template: EmailTemplate.WELCOME, data: { - baseUrl: server.externalDomain || 'http://localhost:2283', + baseUrl: server.externalDomain || DEFAULT_EXTERNAL_DOMAIN, displayName: user.name, username: user.email, password: tempPassword, @@ -100,7 +101,7 @@ export class NotificationService { const { html, text } = this.notificationRepository.renderEmail({ template: EmailTemplate.ALBUM_INVITE, data: { - baseUrl: server.externalDomain || 'http://localhost:2283', + baseUrl: server.externalDomain || DEFAULT_EXTERNAL_DOMAIN, albumId: album.id, albumName: album.albumName, senderName: album.owner.name, @@ -144,7 +145,7 @@ export class NotificationService { const { html, text } = this.notificationRepository.renderEmail({ template: EmailTemplate.ALBUM_UPDATE, data: { - baseUrl: server.externalDomain || 'http://localhost:2283', + baseUrl: server.externalDomain || DEFAULT_EXTERNAL_DOMAIN, albumId: album.id, albumName: album.albumName, recipientName: recipient.name,