mirror of
https://github.com/immich-app/immich.git
synced 2025-01-27 22:22:45 +01:00
refactor(server): build support env (#13163)
This commit is contained in:
parent
3ddb5b8733
commit
0eb77147ef
5 changed files with 36 additions and 18 deletions
server
src
test/repositories
|
@ -408,19 +408,3 @@ export const clsConfig: ClsModuleOptions = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getBuildMetadata = () => ({
|
|
||||||
build: process.env.IMMICH_BUILD,
|
|
||||||
buildUrl: process.env.IMMICH_BUILD_URL,
|
|
||||||
buildImage: process.env.IMMICH_BUILD_IMAGE,
|
|
||||||
buildImageUrl: process.env.IMMICH_BUILD_IMAGE_URL,
|
|
||||||
repository: process.env.IMMICH_REPOSITORY,
|
|
||||||
repositoryUrl: process.env.IMMICH_REPOSITORY_URL,
|
|
||||||
sourceRef: process.env.IMMICH_SOURCE_REF,
|
|
||||||
sourceCommit: process.env.IMMICH_SOURCE_COMMIT,
|
|
||||||
sourceUrl: process.env.IMMICH_SOURCE_URL,
|
|
||||||
thirdPartySourceUrl: process.env.IMMICH_THIRD_PARTY_SOURCE_URL,
|
|
||||||
thirdPartyBugFeatureUrl: process.env.IMMICH_THIRD_PARTY_BUG_FEATURE_URL,
|
|
||||||
thirdPartyDocumentationUrl: process.env.IMMICH_THIRD_PARTY_DOCUMENTATION_URL,
|
|
||||||
thirdPartySupportUrl: process.env.IMMICH_THIRD_PARTY_SUPPORT_URL,
|
|
||||||
});
|
|
||||||
|
|
|
@ -9,6 +9,22 @@ export interface EnvData {
|
||||||
configFile?: string;
|
configFile?: string;
|
||||||
logLevel?: LogLevel;
|
logLevel?: LogLevel;
|
||||||
|
|
||||||
|
buildMetadata: {
|
||||||
|
build?: string;
|
||||||
|
buildUrl?: string;
|
||||||
|
buildImage?: string;
|
||||||
|
buildImageUrl?: string;
|
||||||
|
repository?: string;
|
||||||
|
repositoryUrl?: string;
|
||||||
|
sourceRef?: string;
|
||||||
|
sourceCommit?: string;
|
||||||
|
sourceUrl?: string;
|
||||||
|
thirdPartySourceUrl?: string;
|
||||||
|
thirdPartyBugFeatureUrl?: string;
|
||||||
|
thirdPartyDocumentationUrl?: string;
|
||||||
|
thirdPartySupportUrl?: string;
|
||||||
|
};
|
||||||
|
|
||||||
database: {
|
database: {
|
||||||
skipMigrations: boolean;
|
skipMigrations: boolean;
|
||||||
vectorExtension: VectorExtension;
|
vectorExtension: VectorExtension;
|
||||||
|
|
|
@ -47,6 +47,23 @@ export class ConfigRepository implements IConfigRepository {
|
||||||
environment,
|
environment,
|
||||||
configFile: process.env.IMMICH_CONFIG_FILE,
|
configFile: process.env.IMMICH_CONFIG_FILE,
|
||||||
logLevel: process.env.IMMICH_LOG_LEVEL as LogLevel,
|
logLevel: process.env.IMMICH_LOG_LEVEL as LogLevel,
|
||||||
|
|
||||||
|
buildMetadata: {
|
||||||
|
build: process.env.IMMICH_BUILD,
|
||||||
|
buildUrl: process.env.IMMICH_BUILD_URL,
|
||||||
|
buildImage: process.env.IMMICH_BUILD_IMAGE,
|
||||||
|
buildImageUrl: process.env.IMMICH_BUILD_IMAGE_URL,
|
||||||
|
repository: process.env.IMMICH_REPOSITORY,
|
||||||
|
repositoryUrl: process.env.IMMICH_REPOSITORY_URL,
|
||||||
|
sourceRef: process.env.IMMICH_SOURCE_REF,
|
||||||
|
sourceCommit: process.env.IMMICH_SOURCE_COMMIT,
|
||||||
|
sourceUrl: process.env.IMMICH_SOURCE_URL,
|
||||||
|
thirdPartySourceUrl: process.env.IMMICH_THIRD_PARTY_SOURCE_URL,
|
||||||
|
thirdPartyBugFeatureUrl: process.env.IMMICH_THIRD_PARTY_BUG_FEATURE_URL,
|
||||||
|
thirdPartyDocumentationUrl: process.env.IMMICH_THIRD_PARTY_DOCUMENTATION_URL,
|
||||||
|
thirdPartySupportUrl: process.env.IMMICH_THIRD_PARTY_SUPPORT_URL,
|
||||||
|
},
|
||||||
|
|
||||||
database: {
|
database: {
|
||||||
skipMigrations: process.env.DB_SKIP_MIGRATIONS === 'true',
|
skipMigrations: process.env.DB_SKIP_MIGRATIONS === 'true',
|
||||||
vectorExtension: getVectorExtension(),
|
vectorExtension: getVectorExtension(),
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
||||||
import { getBuildMetadata } from 'src/config';
|
|
||||||
import { serverVersion } from 'src/constants';
|
import { serverVersion } from 'src/constants';
|
||||||
import { StorageCore } from 'src/cores/storage.core';
|
import { StorageCore } from 'src/cores/storage.core';
|
||||||
import { OnEvent } from 'src/decorators';
|
import { OnEvent } from 'src/decorators';
|
||||||
|
@ -36,7 +35,7 @@ export class ServerService extends BaseService {
|
||||||
|
|
||||||
async getAboutInfo(): Promise<ServerAboutResponseDto> {
|
async getAboutInfo(): Promise<ServerAboutResponseDto> {
|
||||||
const version = `v${serverVersion.toString()}`;
|
const version = `v${serverVersion.toString()}`;
|
||||||
const buildMetadata = getBuildMetadata();
|
const { buildMetadata } = this.configRepository.getEnv();
|
||||||
const buildVersions = await this.serverInfoRepository.getBuildVersions();
|
const buildVersions = await this.serverInfoRepository.getBuildVersions();
|
||||||
const licensed = await this.systemMetadataRepository.get(SystemMetadataKey.LICENSE);
|
const licensed = await this.systemMetadataRepository.get(SystemMetadataKey.LICENSE);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ const envData: EnvData = {
|
||||||
port: 3001,
|
port: 3001,
|
||||||
environment: ImmichEnvironment.PRODUCTION,
|
environment: ImmichEnvironment.PRODUCTION,
|
||||||
|
|
||||||
|
buildMetadata: {},
|
||||||
|
|
||||||
database: {
|
database: {
|
||||||
skipMigrations: false,
|
skipMigrations: false,
|
||||||
vectorExtension: DatabaseExtension.VECTORS,
|
vectorExtension: DatabaseExtension.VECTORS,
|
||||||
|
|
Loading…
Reference in a new issue