about summary refs log tree commit diff
path: root/tvix/nar-bridge/src/bin
diff options
context:
space:
mode:
authorYureka <tvl@yuka.dev>2024-07-21T14·41+0200
committeryuka <tvl@yuka.dev>2024-07-22T13·36+0000
commit67335c41b7828e11d28dead8193152da94116e6d (patch)
tree045647f6b1dfc5df077286333aef26ee31f1e33f /tvix/nar-bridge/src/bin
parent6774d9c59ce201864b2af05365b8a7ea2fa1066e (diff)
refactor(tvix): move service addrs into shared clap struct r/8399
Change-Id: I7cab29ecfa1823c2103b4c47b7d784bc31459d55
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12008
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: yuka <yuka@yuka.dev>
Diffstat (limited to 'tvix/nar-bridge/src/bin')
-rw-r--r--tvix/nar-bridge/src/bin/nar-bridge.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/tvix/nar-bridge/src/bin/nar-bridge.rs b/tvix/nar-bridge/src/bin/nar-bridge.rs
index 6823be9e9582..cf312649d147 100644
--- a/tvix/nar-bridge/src/bin/nar-bridge.rs
+++ b/tvix/nar-bridge/src/bin/nar-bridge.rs
@@ -3,19 +3,14 @@ use nar_bridge::AppState;
 use tower::ServiceBuilder;
 use tower_http::trace::{DefaultMakeSpan, TraceLayer};
 use tracing::info;
+use tvix_store::utils::ServiceUrlsGrpc;
 
 /// Expose the Nix HTTP Binary Cache protocol for a tvix-store.
 #[derive(Parser)]
 #[command(author, version, about, long_about = None)]
 struct Cli {
-    #[arg(long, env, default_value = "grpc+http://[::1]:8000")]
-    blob_service_addr: String,
-
-    #[arg(long, env, default_value = "grpc+http://[::1]:8000")]
-    directory_service_addr: String,
-
-    #[arg(long, env, default_value = "grpc+http://[::1]:8000")]
-    path_info_service_addr: String,
+    #[clap(flatten)]
+    service_addrs: ServiceUrlsGrpc,
 
     /// The priority to announce at the `nix-cache-info` endpoint.
     /// A lower number means it's *more preferred.
@@ -50,12 +45,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
 
     // initialize stores
     let (blob_service, directory_service, path_info_service, _nar_calculation_service) =
-        tvix_store::utils::construct_services(
-            cli.blob_service_addr,
-            cli.directory_service_addr,
-            cli.path_info_service_addr,
-        )
-        .await?;
+        tvix_store::utils::construct_services(cli.service_addrs).await?;
 
     let state = AppState::new(blob_service, directory_service, path_info_service);