(overridePrefix = null)
| 58 | }; |
| 59 | |
| 60 | const getRedisClusterOptions = (overridePrefix = null) => { |
| 61 | const clusterNodes = getRedisEnvValue("CLUSTER_NODES", overridePrefix); |
| 62 | |
| 63 | if (clusterNodes) { |
| 64 | const nodes = clusterNodes.split(",").map((node) => { |
| 65 | const [host, port] = node.trim().split(":"); |
| 66 | return { host, port: parseInt(port, 10) || 6379 }; |
| 67 | }); |
| 68 | |
| 69 | const clusterOptions = { |
| 70 | enableReadyCheck: false, |
| 71 | redisOptions: { |
| 72 | password: getRedisEnvValue("PASSWORD", overridePrefix), |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | // Add TLS configuration if provided |
| 77 | const tlsCa = getRedisEnvValue("CA", overridePrefix); |
| 78 | |
| 79 | if (tlsCa) { |
| 80 | clusterOptions.redisOptions.tls = { ca: tlsCa }; |
| 81 | } |
| 82 | |
| 83 | return { cluster: { nodes, options: clusterOptions } }; |
| 84 | } |
| 85 | |
| 86 | return null; |
| 87 | }; |
| 88 | |
| 89 | const getQueueOptions = () => { |
| 90 | // Check if cluster configuration is available |
no test coverage detected