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-03 19:29:40 +02:00
|
|
|
port: 3001,
|
2024-10-02 14:37:26 +02:00
|
|
|
environment: ImmichEnvironment.PRODUCTION,
|
|
|
|
|
2024-10-03 22:33:43 +02:00
|
|
|
buildMetadata: {},
|
|
|
|
|
2024-10-01 19:04:37 +02:00
|
|
|
database: {
|
2024-10-03 23:48:40 +02:00
|
|
|
host: 'database',
|
|
|
|
port: 5432,
|
|
|
|
username: 'postgres',
|
|
|
|
password: 'postgres',
|
|
|
|
name: 'immich',
|
|
|
|
|
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-01 19:04:37 +02:00
|
|
|
storage: {
|
|
|
|
ignoreMountCheckErrors: false,
|
|
|
|
},
|
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-09-27 16:28:56 +02:00
|
|
|
export const newConfigRepositoryMock = (): Mocked<IConfigRepository> => {
|
|
|
|
return {
|
2024-10-01 19:04:37 +02:00
|
|
|
getEnv: vitest.fn().mockReturnValue(envData),
|
2024-09-27 16:28:56 +02:00
|
|
|
};
|
|
|
|
};
|
2024-10-01 19:04:37 +02:00
|
|
|
|
|
|
|
export const mockEnvData = (config: Partial<EnvData>) => ({ ...envData, ...config });
|