mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
⚡ Add allowUnauthorizedCerts to Postgres-Node
This commit is contained in:
parent
2c9e589c72
commit
88b0147292
|
@ -36,10 +36,24 @@ export class Postgres implements ICredentialType {
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Ignore SSL Issues',
|
||||||
|
name: 'allowUnauthorizedCerts',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Connect even if SSL certificate validation is not possible.',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'SSL',
|
displayName: 'SSL',
|
||||||
name: 'ssl',
|
name: 'ssl',
|
||||||
type: 'options' as NodePropertyTypes,
|
type: 'options' as NodePropertyTypes,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
allowUnauthorizedCerts: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'disable',
|
name: 'disable',
|
||||||
|
|
|
@ -189,16 +189,23 @@ export class Postgres implements INodeType {
|
||||||
|
|
||||||
const pgp = pgPromise();
|
const pgp = pgPromise();
|
||||||
|
|
||||||
const config = {
|
const config: IDataObject = {
|
||||||
host: credentials.host as string,
|
host: credentials.host as string,
|
||||||
port: credentials.port as number,
|
port: credentials.port as number,
|
||||||
database: credentials.database as string,
|
database: credentials.database as string,
|
||||||
user: credentials.user as string,
|
user: credentials.user as string,
|
||||||
password: credentials.password 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);
|
const db = pgp(config);
|
||||||
|
|
||||||
let returnItems = [];
|
let returnItems = [];
|
||||||
|
|
Loading…
Reference in a new issue