Skip to content

Commit

Permalink
Adding explicit tls roots configuration to stackdriver (#96)
Browse files Browse the repository at this point in the history
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
  • Loading branch information
msdrigg and lalitb authored Aug 29, 2024
1 parent d7d9af5 commit e6feb3c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions opentelemetry-stackdriver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,15 @@ impl Builder {
} = self;
let uri = http::uri::Uri::from_static("https://cloudtrace.googleapis.com:443");

#[cfg(all(feature = "tls-native-roots", not(feature = "tls-webpki-roots")))]
let tls_config = ClientTlsConfig::new().with_native_roots();
#[cfg(feature = "tls-webpki-roots")]
let tls_config = ClientTlsConfig::new().with_webpki_roots();
#[cfg(not(any(feature = "tls-native-roots", feature = "tls-webpki-roots")))]
let tls_config = ClientTlsConfig::new();

let trace_channel = Channel::builder(uri)
.tls_config(ClientTlsConfig::new())
.tls_config(tls_config.clone())
.map_err(|e| Error::Transport(e.into()))?
.connect()
.await
Expand All @@ -193,7 +200,7 @@ impl Builder {
let log_channel = Channel::builder(http::uri::Uri::from_static(
"https://logging.googleapis.com:443",
))
.tls_config(ClientTlsConfig::new())
.tls_config(tls_config)
.map_err(|e| Error::Transport(e.into()))?
.connect()
.await
Expand Down

0 comments on commit e6feb3c

Please sign in to comment.