2023-03-24 05:55:15 +01:00
|
|
|
import { BadRequestException } from '@nestjs/common';
|
2023-03-22 03:49:19 +01:00
|
|
|
import pkg from '../../../package.json';
|
2023-01-24 04:46:37 +01:00
|
|
|
|
|
|
|
const [major, minor, patch] = pkg.version.split('.');
|
2022-03-22 07:22:04 +01:00
|
|
|
|
2022-07-09 04:26:50 +02:00
|
|
|
export interface IServerVersion {
|
|
|
|
major: number;
|
|
|
|
minor: number;
|
|
|
|
patch: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const serverVersion: IServerVersion = {
|
2023-01-24 04:46:37 +01:00
|
|
|
major: Number(major),
|
|
|
|
minor: Number(minor),
|
|
|
|
patch: Number(patch),
|
2022-03-22 07:22:04 +01:00
|
|
|
};
|
2022-12-08 16:53:18 +01:00
|
|
|
|
|
|
|
export const SERVER_VERSION = `${serverVersion.major}.${serverVersion.minor}.${serverVersion.patch}`;
|
2023-03-22 03:49:19 +01:00
|
|
|
|
|
|
|
export const APP_UPLOAD_LOCATION = './upload';
|
2023-03-24 05:55:15 +01:00
|
|
|
|
|
|
|
export const MACHINE_LEARNING_URL = process.env.IMMICH_MACHINE_LEARNING_URL || 'http://immich-machine-learning:3003';
|
|
|
|
export const MACHINE_LEARNING_ENABLED = MACHINE_LEARNING_URL !== 'false';
|
|
|
|
|
|
|
|
export function assertMachineLearningEnabled() {
|
|
|
|
if (!MACHINE_LEARNING_ENABLED) {
|
|
|
|
throw new BadRequestException('Machine learning is not enabled.');
|
|
|
|
}
|
|
|
|
}
|