2023-01-27 03:22:44 -08:00
|
|
|
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
|
2024-07-04 03:29:44 -07:00
|
|
|
import { sshTunnelProperties } from '@utils/sshTunnel.properties';
|
2019-08-21 09:44:10 -07:00
|
|
|
|
|
|
|
export class Postgres implements ICredentialType {
|
|
|
|
name = 'postgres';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2019-08-21 09:44:10 -07:00
|
|
|
displayName = 'Postgres';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'postgres';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2019-08-21 09:44:10 -07:00
|
|
|
{
|
|
|
|
displayName: 'Host',
|
|
|
|
name: 'host',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2019-08-21 09:44:10 -07:00
|
|
|
default: 'localhost',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Database',
|
|
|
|
name: 'database',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2019-08-21 09:44:10 -07:00
|
|
|
default: 'postgres',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'User',
|
|
|
|
name: 'user',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2019-08-21 09:44:10 -07:00
|
|
|
default: 'postgres',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Password',
|
|
|
|
name: 'password',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2019-08-21 09:44:10 -07:00
|
|
|
typeOptions: {
|
|
|
|
password: true,
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
2020-08-25 08:02:01 -07:00
|
|
|
{
|
|
|
|
displayName: 'Ignore SSL Issues',
|
|
|
|
name: 'allowUnauthorizedCerts',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'boolean',
|
2020-08-25 08:02:01 -07:00
|
|
|
default: false,
|
2022-04-13 23:32:27 -07:00
|
|
|
description: 'Whether to connect even if SSL certificate validation is not possible',
|
2020-08-25 08:02:01 -07:00
|
|
|
},
|
2020-01-10 01:21:45 -08:00
|
|
|
{
|
|
|
|
displayName: 'SSL',
|
|
|
|
name: 'ssl',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'options',
|
2020-08-25 08:02:01 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-07-24 08:36:17 -07:00
|
|
|
allowUnauthorizedCerts: [false],
|
2020-08-25 08:02:01 -07:00
|
|
|
},
|
|
|
|
},
|
2020-01-10 01:21:45 -08:00
|
|
|
options: [
|
2020-01-14 15:26:01 -08:00
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
name: 'Allow',
|
|
|
|
value: 'allow',
|
2020-01-14 15:26:01 -08:00
|
|
|
},
|
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
name: 'Disable',
|
|
|
|
value: 'disable',
|
2020-01-14 15:26:01 -08:00
|
|
|
},
|
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
name: 'Require',
|
2020-01-14 15:26:01 -08:00
|
|
|
value: 'require',
|
|
|
|
},
|
2020-01-10 01:21:45 -08:00
|
|
|
],
|
|
|
|
default: 'disable',
|
|
|
|
},
|
2019-08-21 09:44:10 -07:00
|
|
|
{
|
|
|
|
displayName: 'Port',
|
|
|
|
name: 'port',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'number',
|
2019-08-21 09:44:10 -07:00
|
|
|
default: 5432,
|
|
|
|
},
|
2024-07-04 03:29:44 -07:00
|
|
|
...sshTunnelProperties,
|
2019-08-21 09:44:10 -07:00
|
|
|
];
|
|
|
|
}
|