2024-09-27 16:28:56 +02:00
|
|
|
import { Injectable } from '@nestjs/common';
|
|
|
|
import { getVectorExtension } from 'src/database.config';
|
2024-10-02 14:37:26 +02:00
|
|
|
import { ImmichEnvironment, LogLevel } from 'src/enum';
|
2024-09-27 16:28:56 +02:00
|
|
|
import { EnvData, IConfigRepository } from 'src/interfaces/config.interface';
|
|
|
|
|
2024-10-02 14:37:26 +02:00
|
|
|
// TODO replace src/config validation with class-validator, here
|
|
|
|
|
2024-09-27 16:28:56 +02:00
|
|
|
@Injectable()
|
|
|
|
export class ConfigRepository implements IConfigRepository {
|
|
|
|
getEnv(): EnvData {
|
|
|
|
return {
|
2024-10-02 14:37:26 +02:00
|
|
|
environment: process.env.IMMICH_ENV as ImmichEnvironment,
|
2024-10-01 22:03:55 +02:00
|
|
|
configFile: process.env.IMMICH_CONFIG_FILE,
|
2024-10-02 14:37:26 +02:00
|
|
|
logLevel: process.env.IMMICH_LOG_LEVEL as LogLevel,
|
2024-09-27 16:28:56 +02:00
|
|
|
database: {
|
|
|
|
skipMigrations: process.env.DB_SKIP_MIGRATIONS === 'true',
|
|
|
|
vectorExtension: getVectorExtension(),
|
|
|
|
},
|
2024-10-01 19:04:37 +02:00
|
|
|
storage: {
|
|
|
|
ignoreMountCheckErrors: process.env.IMMICH_IGNORE_MOUNT_CHECK_ERRORS === 'true',
|
|
|
|
},
|
2024-09-27 16:28:56 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|