2024-10-03 21:28:36 +02:00
|
|
|
import { ImmichEnvironment, ImmichWorker } from 'src/enum';
|
2024-10-01 19:04:37 +02:00
|
|
|
import { EnvData, IConfigRepository } from 'src/interfaces/config.interface';
|
2024-09-27 16:28:56 +02:00
|
|
|
import { DatabaseExtension } from 'src/interfaces/database.interface';
|
|
|
|
import { Mocked, vitest } from 'vitest';
|
|
|
|
|
2024-10-01 19:04:37 +02:00
|
|
|
const envData: EnvData = {
|
2024-10-09 22:01:52 +02:00
|
|
|
port: 2283,
|
2024-10-02 14:37:26 +02:00
|
|
|
environment: ImmichEnvironment.PRODUCTION,
|
|
|
|
|
2024-10-03 22:33:43 +02:00
|
|
|
buildMetadata: {},
|
2024-10-17 16:50:54 +02:00
|
|
|
bull: {
|
|
|
|
config: {
|
|
|
|
prefix: 'immich_bull',
|
|
|
|
},
|
|
|
|
queues: [{ name: 'queue-1' }],
|
|
|
|
},
|
2024-10-03 22:33:43 +02:00
|
|
|
|
2024-10-29 21:41:47 +01:00
|
|
|
cls: {
|
|
|
|
config: {},
|
|
|
|
},
|
|
|
|
|
2024-10-01 19:04:37 +02:00
|
|
|
database: {
|
2024-10-24 23:12:25 +02:00
|
|
|
config: {
|
2024-10-29 16:11:34 +01:00
|
|
|
connectionType: 'parts',
|
|
|
|
database: 'immich',
|
2024-10-24 23:12:25 +02:00
|
|
|
type: 'postgres',
|
|
|
|
host: 'database',
|
|
|
|
port: 5432,
|
|
|
|
username: 'postgres',
|
|
|
|
password: 'postgres',
|
|
|
|
name: 'immich',
|
|
|
|
synchronize: false,
|
|
|
|
migrationsRun: true,
|
|
|
|
},
|
2024-10-03 23:48:40 +02:00
|
|
|
|
2024-10-01 19:04:37 +02:00
|
|
|
skipMigrations: false,
|
|
|
|
vectorExtension: DatabaseExtension.VECTORS,
|
|
|
|
},
|
2024-10-02 14:37:26 +02:00
|
|
|
|
2024-10-03 21:45:37 +02:00
|
|
|
licensePublicKey: {
|
|
|
|
client: 'client-public-key',
|
|
|
|
server: 'server-public-key',
|
|
|
|
},
|
|
|
|
|
2024-10-17 23:00:22 +02:00
|
|
|
network: {
|
|
|
|
trustedProxies: [],
|
|
|
|
},
|
|
|
|
|
2024-10-18 00:04:25 +02:00
|
|
|
otel: {
|
|
|
|
metrics: {
|
|
|
|
hostMetrics: false,
|
|
|
|
apiMetrics: {
|
|
|
|
enable: false,
|
|
|
|
ignoreRoutes: [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2024-10-17 16:50:54 +02:00
|
|
|
redis: {
|
|
|
|
host: 'redis',
|
|
|
|
port: 6379,
|
|
|
|
db: 0,
|
|
|
|
},
|
|
|
|
|
2024-10-04 23:09:02 +02:00
|
|
|
resourcePaths: {
|
|
|
|
lockFile: 'build-lock.json',
|
|
|
|
geodata: {
|
|
|
|
dateFile: '/build/geodata/geodata-date.txt',
|
|
|
|
admin1: '/build/geodata/admin1CodesASCII.txt',
|
|
|
|
admin2: '/build/geodata/admin2Codes.txt',
|
|
|
|
cities500: '/build/geodata/cities500.txt',
|
|
|
|
naturalEarthCountriesPath: 'build/ne_10m_admin_0_countries.geojson',
|
|
|
|
},
|
|
|
|
web: {
|
|
|
|
root: '/build/www',
|
|
|
|
indexHtml: '/build/www/index.html',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2024-10-01 19:04:37 +02:00
|
|
|
storage: {
|
|
|
|
ignoreMountCheckErrors: false,
|
|
|
|
},
|
2024-10-03 21:28:36 +02:00
|
|
|
|
2024-10-17 23:00:22 +02:00
|
|
|
telemetry: {
|
|
|
|
apiPort: 8081,
|
|
|
|
microservicesPort: 8082,
|
2024-10-24 23:07:32 +02:00
|
|
|
metrics: new Set(),
|
2024-10-17 23:00:22 +02:00
|
|
|
},
|
|
|
|
|
2024-10-03 21:28:36 +02:00
|
|
|
workers: [ImmichWorker.API, ImmichWorker.MICROSERVICES],
|
2024-10-03 22:58:15 +02:00
|
|
|
|
|
|
|
noColor: false,
|
2024-10-01 19:04:37 +02:00
|
|
|
};
|
|
|
|
|
2024-10-17 00:13:12 +02:00
|
|
|
export const mockEnvData = (config: Partial<EnvData>) => ({ ...envData, ...config });
|
2024-09-27 16:28:56 +02:00
|
|
|
export const newConfigRepositoryMock = (): Mocked<IConfigRepository> => {
|
|
|
|
return {
|
2024-10-17 00:13:12 +02:00
|
|
|
getEnv: vitest.fn().mockReturnValue(mockEnvData({})),
|
2024-11-05 14:07:51 +01:00
|
|
|
getWorker: vitest.fn().mockReturnValue(ImmichWorker.API),
|
2024-09-27 16:28:56 +02:00
|
|
|
};
|
|
|
|
};
|