Skip to content

Commit

Permalink
Add Service<HttpProxy<T>> constructor for providing name
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmunns committed Apr 22, 2024
1 parent 7ce6f4a commit 8727b24
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pingora-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,3 +626,17 @@ pub fn http_proxy_service<SV>(conf: &Arc<ServerConf>, inner: SV) -> Service<Http
HttpProxy::new(inner, conf.clone()),
)
}

/// Create a [Service] from the user implemented [ProxyHttp].
///
/// The returned [Service] can be hosted by a [pingora_core::server::Server] directly.
pub fn http_proxy_service_with_name<SV>(
conf: &Arc<ServerConf>,
inner: SV,
name: &str,
) -> Service<HttpProxy<SV>> {
Service::new(
name.to_string(),
HttpProxy::new(inner, conf.clone()),
)
}

0 comments on commit 8727b24

Please sign in to comment.