Skip to content

Commit

Permalink
feat: support tls:// schema to auto enable tls
Browse files Browse the repository at this point in the history
  • Loading branch information
mattisonchao committed Nov 15, 2024
1 parent b071de7 commit 7023a65
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

@Slf4j
public class OxiaStub implements AutoCloseable {
public static String TLS_SCHEMA = "tls://";
private final ManagedChannel channel;
private final @NonNull OxiaClientGrpc.OxiaClientStub asyncStub;

Expand All @@ -50,7 +51,7 @@ public OxiaStub(
@Nullable BackoffPolicy.Provider backoffProvider) {
this(Grpc.newChannelBuilder(
address,
enableTls
enableTls || address.startsWith(TLS_SCHEMA)
? TlsChannelCredentials.newBuilder().build()
: InsecureChannelCredentials.create())
.directExecutor()
Expand Down

0 comments on commit 7023a65

Please sign in to comment.