Nordix / hiredis-cluster

C client library for Valkey/Redis Cluster. This project is used and sponsored by Ericsson. It is a fork of the now unmaintained hiredis-vip.
BSD 3-Clause "New" or "Revised" License
87 stars 42 forks source link

Setting redis password for redisClusterAsyncContext #141

Closed dembekadam closed 1 year ago

dembekadam commented 1 year ago

I see redisClusterSetOptionPassword(redisClusterContext *cc, ) in hircluster.h but how this can be used with redisClusterAsyncContext ?

In async example the context is created together with connect

redisClusterAsyncContext *cc = redisClusterAsyncConnect(nodes.c_str(), HIRCLUSTER_FLAG_NULL); if (cc && cc->err) { printf("Error: %s\n", cc->errstr); return 1; }

Is it possible to pass redisClusterContext with password to redisClusterAsyncContext before connect ?

bjosv commented 1 year ago

Hi, you should be able to do that like we do in the tests. See for details: https://github.com/Nordix/hiredis-cluster/blob/master/tests/ct_connection.c#L321

dembekadam commented 1 year ago

Thanks, it works fine.