feat(server,web): server config (#4006)

* feat: server config

* chore: open api

* fix: redirect /map to /photos when disabled
This commit is contained in:
Jason Rasmussen
2023-09-08 22:51:46 -04:00
committed by GitHub
parent 3edade6761
commit f1db257628
48 changed files with 1103 additions and 162 deletions

View File

@@ -0,0 +1,9 @@
import { IsBoolean, IsString } from 'class-validator';
export class SystemConfigMapDto {
@IsBoolean()
enabled!: boolean;
@IsString()
tileUrl!: string;
}

View File

@@ -5,6 +5,7 @@ import { IsObject, ValidateNested } from 'class-validator';
import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto';
import { SystemConfigJobDto } from './system-config-job.dto';
import { SystemConfigMachineLearningDto } from './system-config-machine-learning.dto';
import { SystemConfigMapDto } from './system-config-map.dto';
import { SystemConfigOAuthDto } from './system-config-oauth.dto';
import { SystemConfigPasswordLoginDto } from './system-config-password-login.dto';
import { SystemConfigStorageTemplateDto } from './system-config-storage-template.dto';
@@ -20,6 +21,11 @@ export class SystemConfigDto implements SystemConfig {
@IsObject()
machineLearning!: SystemConfigMachineLearningDto;
@Type(() => SystemConfigMapDto)
@ValidateNested()
@IsObject()
map!: SystemConfigMapDto;
@Type(() => SystemConfigOAuthDto)
@ValidateNested()
@IsObject()

View File

@@ -55,7 +55,6 @@ export const defaults = Object.freeze<SystemConfig>({
[QueueName.THUMBNAIL_GENERATION]: { concurrency: 5 },
[QueueName.VIDEO_CONVERSION]: { concurrency: 1 },
},
machineLearning: {
enabled: process.env.IMMICH_MACHINE_LEARNING_ENABLED !== 'false',
url: process.env.IMMICH_MACHINE_LEARNING_URL || 'http://immich-machine-learning:3003',
@@ -75,6 +74,10 @@ export const defaults = Object.freeze<SystemConfig>({
maxDistance: 0.6,
},
},
map: {
enabled: true,
tileUrl: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
},
oauth: {
enabled: false,
issuerUrl: '',
@@ -108,6 +111,7 @@ export enum FeatureFlag {
CLIP_ENCODE = 'clipEncode',
FACIAL_RECOGNITION = 'facialRecognition',
TAG_IMAGE = 'tagImage',
MAP = 'map',
SIDECAR = 'sidecar',
SEARCH = 'search',
OAUTH = 'oauth',
@@ -169,6 +173,7 @@ export class SystemConfigCore {
[FeatureFlag.CLIP_ENCODE]: mlEnabled && config.machineLearning.clip.enabled,
[FeatureFlag.FACIAL_RECOGNITION]: mlEnabled && config.machineLearning.facialRecognition.enabled,
[FeatureFlag.TAG_IMAGE]: mlEnabled && config.machineLearning.classification.enabled,
[FeatureFlag.MAP]: config.map.enabled,
[FeatureFlag.SIDECAR]: true,
[FeatureFlag.SEARCH]: process.env.TYPESENSE_ENABLED !== 'false',

View File

@@ -73,6 +73,10 @@ const updatedConfig = Object.freeze<SystemConfig>({
maxDistance: 0.6,
},
},
map: {
enabled: true,
tileUrl: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
},
oauth: {
autoLaunch: true,
autoRegister: true,