Skip to content

Commit

Permalink
Clarify docs and examples on useTLS meaning. (#765)
Browse files Browse the repository at this point in the history
Co-authored-by: nihohit <[email protected]>
  • Loading branch information
shachlanAmazon and nihohit authored Jan 8, 2024
1 parent 1c0a4cc commit 4029871
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion examples/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ async function sendPingToNode() {
// Check `RedisClientConfiguration/ClusterClientConfiguration` for additional options.
const client = await RedisClient.createClient({
addresses: addresses,
// if the server uses TLS, you'll need to enable it. Otherwise the connection attempt will time out silently.
// useTLS: true,
clientName: "test_standalone_client",
});
Expand Down Expand Up @@ -39,7 +40,8 @@ async function sendPingToRandomNodeInCluster() {
// Check `RedisClientConfiguration/ClusterClientConfiguration` for additional options.
const client = await RedisClusterClient.createClient({
addresses: addresses,
useTLS: true,
// if the cluster nodes use TLS, you'll need to enable it. Otherwise the connection attempt will time out silently.
// useTLS: true,
clientName: "test_cluster_client",
});
// The empty array signifies that there are no additional arguments.
Expand Down
6 changes: 4 additions & 2 deletions examples/python/client_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ async def test_standalone_client(host: str = "localhost", port: int = 6379):
# Check `RedisClientConfiguration/ClusterClientConfiguration` for additional options.
config = BaseClientConfiguration(
addresses=addresses,
client_name = 'test_standalone_client'
client_name="test_standalone_client"
# if the server use TLS, you'll need to enable it. Otherwise the connection attempt will time out silently.
# use_tls=True
)
client = await RedisClient.create(config)
Expand All @@ -58,7 +59,8 @@ async def test_cluster_client(host: str = "localhost", port: int = 6379):
# Check `RedisClientConfiguration/ClusterClientConfiguration` for additional options.
config = BaseClientConfiguration(
addresses=addresses,
client_name = 'test_cluster_client'
client_name="test_cluster_client"
# if the cluster nodes use TLS, you'll need to enable it. Otherwise the connection attempt will time out silently.
# use_tls=True
)
client = await RedisClusterClient.create(config)
Expand Down
2 changes: 2 additions & 0 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ export type BaseClientConfiguration = {
}[];
/**
* True if communication with the cluster should use Transport Level Security.
* Should match the TLS configuration of the server/cluster,
* otherwise the connection attempt will fail.
*/
useTLS?: boolean;
/**
Expand Down
1 change: 1 addition & 0 deletions python/python/glide/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def __init__(
].
If none are set, a default address localhost:6379 will be used.
use_tls (bool): True if communication with the cluster should use Transport Level Security.
Should match the TLS configuration of the server/cluster, otherwise the connection attempt will fail
credentials (RedisCredentials): Credentials for authentication process.
If none are set, the client will not authenticate itself with the server.
read_from (ReadFrom): If not set, `PRIMARY` will be used.
Expand Down

0 comments on commit 4029871

Please sign in to comment.