Skip to content

Commit c1def16

Browse files
committed
CARL Startup -> Replace deprecated into_router() with Routes.
1 parent 09869fe commit c1def16

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

opendut-carl/src/lib.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use pem::Pem;
22
use std::net::SocketAddr;
33
use std::str::FromStr;
4+
use tonic::service::Routes;
45
use tonic_async_interceptor::async_interceptor;
56
use tower::make::Shared;
67
use tower::ServiceExt as _;
@@ -113,20 +114,20 @@ pub async fn create(settings: LoadedConfig) -> anyhow::Result<()> {
113114
}
114115
};
115116

116-
let grpc = tonic::transport::Server::builder()
117-
.layer(async_interceptor(move |request| {
118-
Clone::clone(&grpc_auth_layer).auth_interceptor(request)
119-
}))
120-
.accept_http1(true) //gRPC-web uses HTTP1
117+
let mut routes_builder = Routes::builder();
118+
119+
routes_builder
121120
.add_service(grpc_facades.cluster_manager_facade.into_grpc_service())
122121
.add_service(grpc_facades.metadata_provider_facade.into_grpc_service())
123122
.add_service(grpc_facades.peer_manager_facade.into_grpc_service())
124123
.add_service(grpc_facades.peer_messaging_broker_facade.into_grpc_service());
125124

126-
#[allow(deprecated)]
127-
// Deprecation message: "use of deprecated method `tonic::transport::server::Router::<L>::into_router`: Use `Routes::into_axum_router` instead."
128-
// However, there does not seem to be a way of converting `tonic::transport::server::Router` to `Routes`.
129-
grpc.into_router()
125+
routes_builder
126+
.routes()
127+
.into_axum_router()
128+
.layer(async_interceptor(move |request| {
129+
Clone::clone(&grpc_auth_layer).auth_interceptor(request)
130+
}))
130131
};
131132

132133
let http_grpc = tower::steer::Steer::new(vec![http, grpc], |request: &axum::extract::Request, _services: &[_]| {

0 commit comments

Comments
 (0)