Skip to content

Commit

Permalink
properly fix example defaults
Browse files Browse the repository at this point in the history
Signed-off-by: clux <[email protected]>
  • Loading branch information
clux committed Sep 7, 2023
1 parent c6fa2b4 commit 4654655
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion examples/custom_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();

let config = Config::infer().await?;
let https = config.openssl_https_connector()?;

let https = config.rustls_https_connector()?;
let service = tower::ServiceBuilder::new()
.layer(config.base_uri_layer())
.option_layer(config.auth_layer()?)
Expand Down
8 changes: 4 additions & 4 deletions examples/custom_client_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ async fn main() -> anyhow::Result<()> {
let config = Config::infer().await?;

// Pick TLS at runtime
let use_rustls = std::env::var("USE_RUSTLS").map(|s| s == "1").unwrap_or(false);
let client = if use_rustls {
let https = config.rustls_https_connector()?;
let use_openssl = std::env::var("USE_OPENSSL").map(|s| s == "1").unwrap_or(false);
let client = if use_openssl {
let https = config.openssl_https_connector()?;
let service = ServiceBuilder::new()
.layer(config.base_uri_layer())
.service(hyper::Client::builder().build(https));
Client::new(service, config.default_namespace)
} else {
let https = config.openssl_https_connector()?;
let https = config.rustls_https_connector()?;
let service = ServiceBuilder::new()
.layer(config.base_uri_layer())
.service(hyper::Client::builder().build(https));
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_client_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();

let config = Config::infer().await?;
let https = config.openssl_https_connector()?;
let https = config.rustls_https_connector()?;
let service = ServiceBuilder::new()
.layer(config.base_uri_layer())
// showcase rate limiting; max 10rps, and 4 concurrent
Expand Down

0 comments on commit 4654655

Please sign in to comment.