refactor(tvix/glue): make user-agent more granular

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
This commit is contained in:
Florian Klink 2024-11-28 21:21:01 +02:00 committed by clbot
parent 9fabf8a1b5
commit 8d4a0ac008
2 changed files with 4 additions and 3 deletions

View file

@ -178,8 +178,6 @@ pub struct Fetcher<BS, DS, PS, NS> {
nar_calculation_service: 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> { impl<BS, DS, PS, NS> Fetcher<BS, DS, PS, NS> {
pub fn new( pub fn new(
blob_service: BS, blob_service: BS,
@ -189,7 +187,7 @@ impl<BS, DS, PS, NS> Fetcher<BS, DS, PS, NS> {
) -> Self { ) -> Self {
Self { Self {
http_client: reqwest::Client::builder() http_client: reqwest::Client::builder()
.user_agent(USER_AGENT) .user_agent(crate::USER_AGENT)
.build() .build()
.expect("Client::new()"), .expect("Client::new()"),
blob_service, blob_service,

View file

@ -7,6 +7,9 @@ pub mod tvix_store_io;
mod fetchurl; 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)] #[cfg(test)]
mod tests; mod tests;