diff --git a/packages/nodes-base/credentials/Postgres.credentials.ts b/packages/nodes-base/credentials/Postgres.credentials.ts index 03f0dd80b8..5d4b4ca1f8 100644 --- a/packages/nodes-base/credentials/Postgres.credentials.ts +++ b/packages/nodes-base/credentials/Postgres.credentials.ts @@ -36,10 +36,24 @@ export class Postgres implements ICredentialType { }, default: '', }, + { + displayName: 'Ignore SSL Issues', + name: 'allowUnauthorizedCerts', + type: 'boolean', + default: false, + description: 'Connect even if SSL certificate validation is not possible.', + }, { displayName: 'SSL', name: 'ssl', type: 'options' as NodePropertyTypes, + displayOptions: { + show: { + allowUnauthorizedCerts: [ + false, + ], + }, + }, options: [ { name: 'disable', diff --git a/packages/nodes-base/nodes/Postgres/Postgres.node.ts b/packages/nodes-base/nodes/Postgres/Postgres.node.ts index f92234eb06..7c706a0fc2 100644 --- a/packages/nodes-base/nodes/Postgres/Postgres.node.ts +++ b/packages/nodes-base/nodes/Postgres/Postgres.node.ts @@ -189,16 +189,23 @@ export class Postgres implements INodeType { const pgp = pgPromise(); - const config = { + const config: IDataObject = { host: credentials.host as string, port: credentials.port as number, database: credentials.database as string, user: credentials.user as string, password: credentials.password as string, - ssl: !['disable', undefined].includes(credentials.ssl as string | undefined), - sslmode: (credentials.ssl as string) || 'disable', }; + if (credentials.allowUnauthorizedCerts === true) { + config.ssl = { + rejectUnauthorized: false, + }; + } else { + config.ssl = !['disable', undefined].includes(credentials.ssl as string | undefined); + config.sslmode = (credentials.ssl as string) || 'disable'; + } + const db = pgp(config); let returnItems = [];