n8n/packages/nodes-base/credentials/Postgres.credentials.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

201 lines
3.3 KiB
TypeScript
Raw Normal View History

import type { ICredentialType, INodeProperties } from 'n8n-workflow';
2019-08-21 09:44:10 -07:00
export class Postgres implements ICredentialType {
name = 'postgres';
2019-08-21 09:44:10 -07:00
displayName = 'Postgres';
documentationUrl = 'postgres';
properties: INodeProperties[] = [
2019-08-21 09:44:10 -07:00
{
displayName: 'Host',
name: 'host',
type: 'string',
2019-08-21 09:44:10 -07:00
default: 'localhost',
},
{
displayName: 'Database',
name: 'database',
type: 'string',
2019-08-21 09:44:10 -07:00
default: 'postgres',
},
{
displayName: 'User',
name: 'user',
type: 'string',
2019-08-21 09:44:10 -07:00
default: 'postgres',
},
{
displayName: 'Password',
name: 'password',
type: 'string',
2019-08-21 09:44:10 -07:00
typeOptions: {
password: true,
},
default: '',
},
{
displayName: 'Ignore SSL Issues',
name: 'allowUnauthorizedCerts',
type: 'boolean',
default: false,
description: 'Whether to connect even if SSL certificate validation is not possible',
},
{
displayName: 'SSL',
name: 'ssl',
type: 'options',
displayOptions: {
show: {
allowUnauthorizedCerts: [false],
},
},
options: [
2020-01-14 15:26:01 -08:00
{
name: 'Allow',
value: 'allow',
2020-01-14 15:26:01 -08:00
},
{
name: 'Disable',
value: 'disable',
2020-01-14 15:26:01 -08:00
},
{
name: 'Require',
2020-01-14 15:26:01 -08:00
value: 'require',
},
{
name: 'Verify (Not Implemented)',
2020-01-14 15:26:01 -08:00
value: 'verify',
},
{
name: 'Verify-Full (Not Implemented)',
2020-01-14 15:26:01 -08:00
value: 'verify-full',
2020-10-22 06:46:03 -07:00
},
],
default: 'disable',
},
2019-08-21 09:44:10 -07:00
{
displayName: 'Port',
name: 'port',
type: 'number',
2019-08-21 09:44:10 -07:00
default: 5432,
},
2023-04-03 08:18:01 -07:00
{
displayName: 'SSH Tunnel',
name: 'sshTunnel',
type: 'boolean',
default: false,
},
{
displayName: 'SSH Authenticate with',
name: 'sshAuthenticateWith',
type: 'options',
default: 'password',
options: [
{
name: 'Password',
value: 'password',
},
{
name: 'Private Key',
value: 'privateKey',
},
],
displayOptions: {
show: {
sshTunnel: [true],
},
},
},
{
displayName: 'SSH Host',
name: 'sshHost',
type: 'string',
default: 'localhost',
displayOptions: {
show: {
sshTunnel: [true],
},
},
},
{
displayName: 'SSH Port',
name: 'sshPort',
type: 'number',
default: 22,
displayOptions: {
show: {
sshTunnel: [true],
},
},
},
{
displayName: 'SSH Postgres Port',
name: 'sshPostgresPort',
type: 'number',
default: 5432,
displayOptions: {
show: {
sshTunnel: [true],
},
},
},
{
displayName: 'SSH User',
name: 'sshUser',
type: 'string',
default: 'root',
displayOptions: {
show: {
sshTunnel: [true],
},
},
},
{
displayName: 'SSH Password',
name: 'sshPassword',
type: 'string',
typeOptions: {
password: true,
},
default: '',
displayOptions: {
show: {
sshTunnel: [true],
sshAuthenticateWith: ['password'],
},
},
},
{
displayName: 'Private Key',
name: 'privateKey',
type: 'string',
typeOptions: {
rows: 4,
password: true,
},
default: '',
displayOptions: {
show: {
sshTunnel: [true],
sshAuthenticateWith: ['privateKey'],
},
},
},
{
displayName: 'Passphrase',
name: 'passphrase',
type: 'string',
default: '',
description: 'Passphase used to create the key, if no passphase was used leave empty',
displayOptions: {
show: {
sshTunnel: [true],
sshAuthenticateWith: ['privateKey'],
},
},
},
2019-08-21 09:44:10 -07:00
];
}