🔀 Merge branch 'krasaee-master'

This commit is contained in:
Jan Oberhauser 2020-01-14 17:21:35 -06:00
commit baa8eb5fd9
2 changed files with 24 additions and 1 deletions

View file

@ -35,6 +35,19 @@ export class Postgres implements ICredentialType {
},
default: '',
},
{
displayName: 'SSL',
name: 'ssl',
type: 'options' as NodePropertyTypes,
options: [
{ name: 'disable', value: 'disable' },
{ name: 'allow', value: 'allow' },
{ name: 'require', value: 'require' },
{ name: 'verify', value: 'verify (not implemented)' },
{ name: 'verify-full', value: 'verify-full (not implemented)' }
],
default: 'disable',
},
{
displayName: 'Port',
name: 'port',

View file

@ -202,7 +202,17 @@ export class Postgres implements INodeType {
const pgp = pgPromise();
const db = pgp(`postgres://${credentials.user}:${credentials.password}@${credentials.host}:${credentials.port}/${credentials.database}`);
const config = {
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',
};
const db = pgp(config);
let returnItems = [];