2024-01-10 05:04:16 +01:00
|
|
|
import { PostgreSqlContainer } from '@testcontainers/postgresql';
|
2024-02-20 16:53:12 +01:00
|
|
|
import path from 'node:path';
|
2024-01-10 05:04:16 +01:00
|
|
|
|
|
|
|
export default async () => {
|
2024-02-20 16:53:12 +01:00
|
|
|
let IMMICH_TEST_ASSET_PATH: string = '';
|
|
|
|
|
|
|
|
if (process.env.IMMICH_TEST_ASSET_PATH === undefined) {
|
|
|
|
IMMICH_TEST_ASSET_PATH = path.normalize(`${__dirname}/../../test/assets/`);
|
|
|
|
process.env.IMMICH_TEST_ASSET_PATH = IMMICH_TEST_ASSET_PATH;
|
|
|
|
} else {
|
|
|
|
IMMICH_TEST_ASSET_PATH = process.env.IMMICH_TEST_ASSET_PATH;
|
|
|
|
}
|
|
|
|
|
2024-02-07 03:46:38 +01:00
|
|
|
const pg = await new PostgreSqlContainer('tensorchord/pgvecto-rs:pg14-v0.2.0')
|
2024-01-10 05:04:16 +01:00
|
|
|
.withDatabase('immich')
|
|
|
|
.withUsername('postgres')
|
|
|
|
.withPassword('postgres')
|
|
|
|
.withReuse()
|
|
|
|
.withCommand(['-c', 'fsync=off', '-c', 'shared_preload_libraries=vectors.so'])
|
|
|
|
.start();
|
|
|
|
|
|
|
|
process.env.DB_URL = pg.getConnectionUri();
|
|
|
|
process.env.NODE_ENV = 'development';
|
|
|
|
process.env.TZ = 'Z';
|
2024-02-20 16:53:12 +01:00
|
|
|
|
|
|
|
if (process.env.LOG_LEVEL === undefined) {
|
|
|
|
process.env.LOG_LEVEL = 'fatal';
|
|
|
|
}
|
2024-01-10 05:04:16 +01:00
|
|
|
};
|