MCPcopy Create free account
hub / github.com/Qovery/engine / new_engine_client_test

Function new_engine_client_test

app/src/grpc/mod.rs:89–114  ·  view source on GitHub ↗
(mut client: Option<DuplexStream>)

Source from the content-addressed store, hash-verified

87 use tower::service_fn;
88
89 pub async fn new_engine_client_test(mut client: Option<DuplexStream>) -> GrpcEngineClient {
90 let channel = Endpoint::try_from("http://[::]:50051")
91 .unwrap()
92 .connect_with_connector(service_fn(move |_: Uri| {
93 let client = client.take();
94
95 async move {
96 if let Some(client) = client {
97 Ok(hyper_util::rt::TokioIo::new(client))
98 } else {
99 Err(std::io::Error::other("Client already taken"))
100 }
101 }
102 }))
103 .await
104 .unwrap();
105
106 let channel = ServiceBuilder::new()
107 .layer(InterceptorLayer::new(QoveryInterceptor {
108 token: AsciiMetadataValue::from_static(""),
109 cluster_id: AsciiMetadataValue::from_static(""),
110 }))
111 .service(channel);
112
113 EngineClient::new(channel)
114 }
115}

Calls

no outgoing calls