Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hyper_builder field to Config #33

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased
### Added
- `hyper_builder` field was added to `Config` in order to allow specifying additional hyper options.
- `default-tls`, `rustls-native`, and `rustls-webpki` features to allow usage of rustls for the https client
### Changed
### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ futures = "0.3.8"
http = "0.2.1"
hyper = { version = "0.14.2", features = ["full"] }
hyper-rustls = { version = "0.22.1", optional = true }
hyper-tls = { version = "0.5.0", optional = true, no-default-features = true }
hyper-tls = { version = "0.5.0", optional = true, default-features = true }
lazy_static = { version = "1.4.0", optional = true }
opentelemetry = { version = "0.15", features = ["tokio", "rt-tokio"] }
prometheus = { version = "0.13", optional = true }
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ pub struct Config {
pub address: String,
/// The consul secret token to make authenticated requests to the consul server.
pub token: Option<String>,

/// The hyper builder for the internal http client.
#[serde(skip)]
pub hyper_builder: hyper::client::Builder,
}

impl Config {
Expand All @@ -165,6 +169,7 @@ impl Config {
Config {
address: addr,
token: Some(token),
hyper_builder: Default::default(),
}
}
}
Expand Down Expand Up @@ -233,7 +238,7 @@ impl Consul {
/// - [Config](consul::Config)
pub fn new(config: Config) -> Self {
let https = https_client();
let https_client = hyper::Client::builder().build::<_, hyper::Body>(https);
let https_client = config.hyper_builder.build::<_, hyper::Body>(https);
Consul {
https_client,
config,
Expand Down