Skip to content

Commit

Permalink
fix(core): Add an option to enable dual-stack lookup to support IPv6 …
Browse files Browse the repository at this point in the history
…for redis (#13118)
  • Loading branch information
netroy authored Feb 7, 2025
1 parent 8b28d6c commit be39d0a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/@n8n/config/src/configs/scaling-mode.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class RedisConfig {
/** Whether to enable TLS on Redis connections. */
@Env('QUEUE_BULL_REDIS_TLS')
tls: boolean = false;

/** Whether to enable dual-stack hostname resolution for Redis connections. */
@Env('QUEUE_BULL_REDIS_DUALSTACK')
dualStack: boolean = false;
}

@Config
Expand Down
1 change: 1 addition & 0 deletions packages/@n8n/config/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ describe('GlobalConfig', () => {
username: '',
clusterNodes: '',
tls: false,
dualStack: false,
},
gracefulShutdownTimeout: 30,
prefix: 'bull',
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/services/redis-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class RedisClientService extends TypedEmitter<RedisEventMap> {
}

private getOptions({ extraOptions }: { extraOptions?: RedisOptions }) {
const { username, password, db, tls } = this.globalConfig.queue.bull.redis;
const { username, password, db, tls, dualStack } = this.globalConfig.queue.bull.redis;

/**
* Disabling ready check allows quick reconnection to Redis if Redis becomes
Expand All @@ -153,6 +153,8 @@ export class RedisClientService extends TypedEmitter<RedisEventMap> {
...extraOptions,
};

if (dualStack) options.family = 0;

if (tls) options.tls = {}; // enable TLS with default Node.js settings

return options;
Expand Down

0 comments on commit be39d0a

Please sign in to comment.