mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Centralize SSH Tunnel management (#9906)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
committed by
GitHub
parent
86018aa6e0
commit
85aa560a5d
@@ -4,7 +4,6 @@ import type {
|
||||
INodeCredentialTestResult,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { Client } from 'ssh2';
|
||||
import { configurePostgres } from '../transport';
|
||||
|
||||
import type { PgpClient, PostgresNodeCredentials } from '../helpers/interfaces';
|
||||
@@ -15,13 +14,11 @@ export async function postgresConnectionTest(
|
||||
): Promise<INodeCredentialTestResult> {
|
||||
const credentials = credential.data as PostgresNodeCredentials;
|
||||
|
||||
let sshClientCreated: Client | undefined = new Client();
|
||||
let pgpClientCreated: PgpClient | undefined;
|
||||
|
||||
try {
|
||||
const { db, pgp, sshClient } = await configurePostgres(credentials, {}, sshClientCreated);
|
||||
const { db, pgp } = await configurePostgres.call(this, credentials, {});
|
||||
|
||||
sshClientCreated = sshClient;
|
||||
pgpClientCreated = pgp;
|
||||
|
||||
await db.connect();
|
||||
@@ -45,9 +42,6 @@ export async function postgresConnectionTest(
|
||||
message,
|
||||
};
|
||||
} finally {
|
||||
if (sshClientCreated) {
|
||||
sshClientCreated.end();
|
||||
}
|
||||
if (pgpClientCreated) {
|
||||
pgpClientCreated.end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user