Skip to content

Commit

Permalink
add Server::new_with_registry
Browse files Browse the repository at this point in the history
  • Loading branch information
blind-oracle committed Sep 1, 2024
1 parent 796bcd6 commit fd97874
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "README.md"
ahash = "0.8"
anyhow = "1.0"
arc-swap = "1"
async-trait = "0.1"
async-trait = "0.1.81"
axum = "0.7"
backoff = { version = "0.4", features = ["tokio"] }
base64 = "0.22"
Expand Down
14 changes: 12 additions & 2 deletions src/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,19 +517,29 @@ impl Server {
addr: Addr,
router: Router,
options: Options,
registry: &Registry,
metrics: Metrics,
rustls_cfg: Option<rustls::ServerConfig>,
) -> Self {
Self {
addr,
router,
options,
metrics: Metrics::new(registry),
metrics,
tracker: TaskTracker::new(),
tls_acceptor: rustls_cfg.map(|x| TlsAcceptor::from(Arc::new(x))),
}
}

pub fn new_with_registry(
addr: Addr,
router: Router,
options: Options,
registry: &Registry,
rustls_cfg: Option<rustls::ServerConfig>,
) -> Self {
Self::new(addr, router, options, Metrics::new(registry), rustls_cfg)
}

fn listen(&self) -> Result<Listener, Error> {
Ok(match &self.addr {
Addr::Tcp(v) => Listener::Tcp(listen_tcp_backlog(*v, self.options.backlog)?),
Expand Down

0 comments on commit fd97874

Please sign in to comment.