-
-
Notifications
You must be signed in to change notification settings - Fork 335
Description
Description
Options are ignored when configuring Redis in Cluster mode.
Reproduction steps
Steps to reproduce the behavior:
- Due to [request] Custom Redis client settings using environment variables #225 - create a custom configuration file (below)
{
"debug": false,
"host": "0.0.0.0",
"port": 6001,
"appManager.array.apps": [
{
"id": "project-ws",
"key": "project",
"secret": "SECRET",
"enabled": true,
"cache": {
"enabled": true,
"ttl": 360
}
}
],
"adapter": {
"driver": "redis",
"redis": {
"clusterMode": true
}
},
"database": {
"redis": {
"tls": {
"rejectUnauthorized": false
},
"clusterNodes": [
{
"host": "clustercfg.project-redis-cluster.use1.cache.amazonaws.com",
"port": 6379
}
]
}
}
}Notice TLS value is not working. If we look at the line where values are being parsed we notice the values are being spread directly the configuration.
https://github.com/soketi/soketi/blob/1.x/src/adapters/redis-adapter.ts#L50
When reviewing ioredis - the actual options for Redis (not the cluster) are configured under redisOptions with the root level configuration being the ClusterOptions. So then I figure perhaps this isn't a bug and we (the consumers) have to map values in our configuration file to work against that.
However, when I see the base options being configured for retries, retry strategy those are not being applied as they are applied to the root (cluster settings) and not the individual RedisOptions.
https://github.com/soketi/soketi/blob/1.x/src/adapters/redis-adapter.ts#L43-L51
So you can workaround this in meantime with a more verbose configuration file like:
{
"debug": true,
"host": "0.0.0.0",
"port": 6001,
"appManager.array.apps": [
{
"id": "project-ws",
"key": "project",
"secret": "SECRET",
"enabled": true,
"cache": {
"enabled": true,
"ttl": 360
}
}
],
"adapter": {
"driver": "redis",
"redis": {
"clusterMode": true,
"redisSubOptions": {
"redisOptions": {
"tls": {
"rejectUnauthorized": false
}
}
},
"redisPubOptions": {
"redisOptions": {
"tls": {
"rejectUnauthorized": false
}
}
}
}
},
"database": {
"redis": {
"tls": {
"rejectUnauthorized": false
},
"clusterNodes": [
{
"host": "clustercfg.project-elasticache-cluster.use1.cache.amazonaws.com",
"port": 6379
}
]
}
}
}Expected behavior
Expect TLS setting to take place.
Environment
- Soketi version (i.e. 1.3.0): soketi:1.6-16-alpine
- Adapter (local, redis): redis
- App Manager (array, mysql, postgres, dynamodb) : array
- Queue (sqs, redis, sync): redis
- Cache Managers (memory, redis): redis