From 15a0775a3ce3e2a11d3565adde0a3e03dedf5575 Mon Sep 17 00:00:00 2001 From: shuiyisong <113876041+shuiyisong@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:44:02 +0800 Subject: [PATCH] chore: use https when tls is present (#2671) * chore: use https * chore: use tls --- src/common/grpc/src/channel_manager.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/grpc/src/channel_manager.rs b/src/common/grpc/src/channel_manager.rs index 98451f13ee..e47722c4e2 100644 --- a/src/common/grpc/src/channel_manager.rs +++ b/src/common/grpc/src/channel_manager.rs @@ -163,7 +163,14 @@ impl ChannelManager { } fn build_endpoint(&self, addr: &str) -> Result { - let mut endpoint = Endpoint::new(format!("http://{addr}")).context(CreateChannelSnafu)?; + let http_prefix = if self.client_tls_config.is_some() { + "https" + } else { + "http" + }; + + let mut endpoint = + Endpoint::new(format!("{http_prefix}://{addr}")).context(CreateChannelSnafu)?; if let Some(dur) = self.config.timeout { endpoint = endpoint.timeout(dur);