mirror of
https://github.com/immich-app/immich.git
synced 2025-12-21 01:11:16 +03:00
refactor: better postgres connection param typing (#13800)
This commit is contained in:
@@ -3,7 +3,7 @@ import { QueueOptions } from 'bullmq';
|
||||
import { RedisOptions } from 'ioredis';
|
||||
import { OpenTelemetryModuleOptions } from 'nestjs-otel/lib/interfaces';
|
||||
import { ImmichEnvironment, ImmichTelemetry, ImmichWorker, LogLevel } from 'src/enum';
|
||||
import { VectorExtension } from 'src/interfaces/database.interface';
|
||||
import { DatabaseConnectionParams, VectorExtension } from 'src/interfaces/database.interface';
|
||||
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions.js';
|
||||
|
||||
export const IConfigRepository = 'IConfigRepository';
|
||||
@@ -37,7 +37,7 @@ export interface EnvData {
|
||||
};
|
||||
|
||||
database: {
|
||||
config: PostgresConnectionOptions;
|
||||
config: PostgresConnectionOptions & DatabaseConnectionParams;
|
||||
skipMigrations: boolean;
|
||||
vectorExtension: VectorExtension;
|
||||
};
|
||||
|
||||
@@ -7,6 +7,22 @@ export enum DatabaseExtension {
|
||||
|
||||
export type VectorExtension = DatabaseExtension.VECTOR | DatabaseExtension.VECTORS;
|
||||
|
||||
export type DatabaseConnectionURL = {
|
||||
connectionType: 'url';
|
||||
url: string;
|
||||
};
|
||||
|
||||
export type DatabaseConnectionParts = {
|
||||
connectionType: 'parts';
|
||||
host: string;
|
||||
port: number;
|
||||
username: string;
|
||||
password: string;
|
||||
database: string;
|
||||
};
|
||||
|
||||
export type DatabaseConnectionParams = DatabaseConnectionURL | DatabaseConnectionParts;
|
||||
|
||||
export enum VectorIndex {
|
||||
CLIP = 'clip_index',
|
||||
FACE = 'face_index',
|
||||
|
||||
Reference in New Issue
Block a user