Skip to content

Commit

Permalink
feat(Redis Node): Add support for TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed May 2, 2024
1 parent 7ff24f1 commit e4fd175
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/nodes-base/credentials/Redis.credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ export class Redis implements ICredentialType {
type: 'number',
default: 0,
},
{
displayName: 'SSL',
name: 'ssl',
type: 'boolean',
default: false,
},
];
}
5 changes: 3 additions & 2 deletions packages/nodes-base/nodes/Redis/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import type {
} from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';

import { createClient } from 'redis';
import { type RedisClientOptions, createClient } from 'redis';
export type RedisClientType = ReturnType<typeof createClient>;

export function setupRedisClient(credentials: ICredentialDataDecryptedObject): RedisClientType {
const redisOptions = {
const redisOptions: RedisClientOptions = {
socket: {
host: credentials.host as string,
port: credentials.port as number,
tls: credentials.ssl === true,
},
database: credentials.database as number,
password: (credentials.password as string) || undefined,
Expand Down

0 comments on commit e4fd175

Please sign in to comment.