chore: use https when tls is present (#2671)

* chore: use https

* chore: use tls
This commit is contained in:
shuiyisong
2023-11-01 10:44:02 +08:00
committed by GitHub
parent 180bc64cb0
commit 15a0775a3c

View File

@@ -163,7 +163,14 @@ impl ChannelManager {
}
fn build_endpoint(&self, addr: &str) -> Result<Endpoint> {
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);