diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rs index 331683d5d1..9bdf038b26 100644 --- a/crates/client/src/telemetry.rs +++ b/crates/client/src/telemetry.rs @@ -145,11 +145,14 @@ const FLUSH_INTERVAL: Duration = Duration::from_secs(1); #[cfg(not(debug_assertions))] const FLUSH_INTERVAL: Duration = Duration::from_secs(60 * 5); -static ZED_CLIENT_CHECKSUM_SEED: Lazy> = Lazy::new(|| { +static ZED_CLIENT_CHECKSUM_SEED: Lazy>> = Lazy::new(|| { option_env!("ZED_CLIENT_CHECKSUM_SEED") - .unwrap_or("development-checksum-seed") - .as_bytes() - .into() + .map(|s| s.as_bytes().into()) + .or_else(|| { + env::var("ZED_CLIENT_CHECKSUM_SEED") + .ok() + .map(|s| s.as_bytes().into()) + }) }); impl Telemetry { @@ -510,6 +513,10 @@ impl Telemetry { return; } + let Some(checksum_seed) = &*ZED_CLIENT_CHECKSUM_SEED else { + return; + }; + let this = self.clone(); self.executor .spawn( @@ -551,9 +558,9 @@ impl Telemetry { } let mut summer = Sha256::new(); - summer.update(&*ZED_CLIENT_CHECKSUM_SEED); + summer.update(checksum_seed); summer.update(&json_bytes); - summer.update(&*ZED_CLIENT_CHECKSUM_SEED); + summer.update(checksum_seed); let mut checksum = String::new(); for byte in summer.finalize().as_slice() { use std::fmt::Write; diff --git a/script/zed-local b/script/zed-local index 068235730d..1b1852043b 100755 --- a/script/zed-local +++ b/script/zed-local @@ -142,6 +142,7 @@ setTimeout(() => { ZED_RPC_URL: "http://localhost:8080/rpc", ZED_ADMIN_API_TOKEN: "secret", ZED_WINDOW_SIZE: size, + ZED_CLIENT_CHECKSUM_SEED: "development-checksum-seed", PATH: process.env.PATH, RUST_LOG: process.env.RUST_LOG || "info", },