Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3515146
D5928.id19553.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
927 B
Referenced Files
None
Subscribers
None
D5928.id19553.diff
View Options
diff --git a/services/commtest/src/tunnelbroker/tunnelbroker_utils.rs b/services/commtest/src/tunnelbroker/tunnelbroker_utils.rs
--- a/services/commtest/src/tunnelbroker/tunnelbroker_utils.rs
+++ b/services/commtest/src/tunnelbroker/tunnelbroker_utils.rs
@@ -1,4 +1,17 @@
+use std::env;
+use tonic::transport::Channel;
+use tonic::transport::Error;
pub mod proto {
tonic::include_proto!("tunnelbroker");
}
pub use proto::tunnelbroker_service_client::TunnelbrokerServiceClient;
+
+pub async fn tonic_client_builder(
+) -> Result<TunnelbrokerServiceClient<Channel>, Error> {
+ let port = env::var("COMM_SERVICES_TUNNELBROKER_PORT").expect(
+ "`COMM_SERVICES_TUNNELBROKER_PORT` environment variable expected but not received",
+ );
+ let host = env::var("COMM_SERVICES_TUNNELBROKER_HOST")
+ .unwrap_or(String::from("localhost"));
+ TunnelbrokerServiceClient::connect(format!("http://{}:{}", host, port)).await
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 7:42 AM (18 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2694024
Default Alt Text
D5928.id19553.diff (927 B)
Attached To
Mode
D5928: [services/commtest] Tunnelbroker - Adding the tonic client builder function
Attached
Detach File
Event Timeline
Log In to Comment