Skip to content

Commit

Permalink
Merge pull request #33 from arthurprs/as/hyper-config
Browse files Browse the repository at this point in the history
Add hyper_builder field to Config
  • Loading branch information
kushudai authored Jun 19, 2023
2 parents 7637977 + 5fc79d3 commit b72cd33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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
- `opentelemetry` feature must be specified to enable opentelemetry support.
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,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 @@ -171,6 +175,7 @@ impl Config {
Config {
address: addr,
token: Some(token),
hyper_builder: Default::default(),
}
}
}
Expand Down Expand Up @@ -240,7 +245,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

0 comments on commit b72cd33

Please sign in to comment.