about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-11-28T19·21+0200
committerclbot <clbot@tvl.fyi>2024-11-29T08·09+0000
commit8d4a0ac008f4e86e340242e394c74d08ca401f92 (patch)
tree80d7eef1e5e9e47cf54cb06a00cfd1cb5cb87b94 /tvix
parent9fabf8a1b5968658afdb0e5dff28e9b550854762 (diff)
refactor(tvix/glue): make user-agent more granular r/8969
Use the crate name in the user-agent, similar to tvix-[ca]store.

Change-Id: I10527fb1f29006dbfd8630d8bb1f00d7905efdd3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12851
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Vladimir Kryachko <v.kryachko@gmail.com>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r--tvix/glue/src/fetchers/mod.rs4
-rw-r--r--tvix/glue/src/lib.rs3
2 files changed, 4 insertions, 3 deletions
diff --git a/tvix/glue/src/fetchers/mod.rs b/tvix/glue/src/fetchers/mod.rs
index 035e9f11a8a7..7050ad48f51a 100644
--- a/tvix/glue/src/fetchers/mod.rs
+++ b/tvix/glue/src/fetchers/mod.rs
@@ -178,8 +178,6 @@ pub struct Fetcher<BS, DS, PS, NS> {
     nar_calculation_service: NS,
 }
 
-const USER_AGENT: &str = concat!("Tvix/", env!("CARGO_PKG_VERSION"));
-
 impl<BS, DS, PS, NS> Fetcher<BS, DS, PS, NS> {
     pub fn new(
         blob_service: BS,
@@ -189,7 +187,7 @@ impl<BS, DS, PS, NS> Fetcher<BS, DS, PS, NS> {
     ) -> Self {
         Self {
             http_client: reqwest::Client::builder()
-                .user_agent(USER_AGENT)
+                .user_agent(crate::USER_AGENT)
                 .build()
                 .expect("Client::new()"),
             blob_service,
diff --git a/tvix/glue/src/lib.rs b/tvix/glue/src/lib.rs
index 320d1f6fede2..8f72424d59cc 100644
--- a/tvix/glue/src/lib.rs
+++ b/tvix/glue/src/lib.rs
@@ -7,6 +7,9 @@ pub mod tvix_store_io;
 
 mod fetchurl;
 
+// Used as user agent in various HTTP Clients
+const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
+
 #[cfg(test)]
 mod tests;