From 4e2568fd6e18f048c84cb5c29612f0fffee41f17 Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 16 Jun 2021 17:12:49 +0200 Subject: [PATCH] disable amplitude on debug build --- meilisearch-http/src/lib.rs | 2 +- meilisearch-http/src/main.rs | 6 +++--- meilisearch-http/src/option.rs | 2 +- meilisearch-http/tests/common/server.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meilisearch-http/src/lib.rs b/meilisearch-http/src/lib.rs index 8788d45d1..130389fdc 100644 --- a/meilisearch-http/src/lib.rs +++ b/meilisearch-http/src/lib.rs @@ -6,7 +6,7 @@ mod index_controller; pub mod option; pub mod routes; -#[cfg(feature = "analytics")] +#[cfg(all(not(debug_assertions), feature = "analytics"))] pub mod analytics; pub use self::data::Data; diff --git a/meilisearch-http/src/main.rs b/meilisearch-http/src/main.rs index ae2cb3777..2787d8b78 100644 --- a/meilisearch-http/src/main.rs +++ b/meilisearch-http/src/main.rs @@ -5,7 +5,7 @@ use main_error::MainError; use meilisearch_http::{create_app, Data, Opt}; use structopt::StructOpt; -#[cfg(feature = "analytics")] +#[cfg(all(not(debug_assertions), feature = "analytics"))] use meilisearch_http::analytics; #[cfg(target_os = "linux")] @@ -57,7 +57,7 @@ async fn main() -> Result<(), MainError> { let data = Data::new(opt.clone())?; - #[cfg(feature = "analytics")] + #[cfg(all(not(debug_assertions), feature = "analytics"))] if !opt.no_analytics { let analytics_data = data.clone(); let analytics_opt = opt.clone(); @@ -121,7 +121,7 @@ pub fn print_launch_resume(opt: &Opt, data: &Data) { env!("CARGO_PKG_VERSION").to_string() ); - #[cfg(feature = "analytics")] + #[cfg(all(not(debug_assertions), feature = "analytics"))] { if opt.no_analytics { eprintln!("Anonymous telemetry:\t\"Disabled\""); diff --git a/meilisearch-http/src/option.rs b/meilisearch-http/src/option.rs index 54a50742a..8f925bad8 100644 --- a/meilisearch-http/src/option.rs +++ b/meilisearch-http/src/option.rs @@ -104,7 +104,7 @@ pub struct Opt { pub env: String, /// Do not send analytics to Meili. - #[cfg(feature = "analytics")] + #[cfg(all(not(debug_assertions), feature = "analytics"))] #[structopt(long, env = "MEILI_NO_ANALYTICS")] pub no_analytics: bool, diff --git a/meilisearch-http/tests/common/server.rs b/meilisearch-http/tests/common/server.rs index 2c47a8ca8..bf6c95474 100644 --- a/meilisearch-http/tests/common/server.rs +++ b/meilisearch-http/tests/common/server.rs @@ -71,7 +71,7 @@ pub fn default_settings(dir: impl AsRef) -> Opt { http_addr: "127.0.0.1:7700".to_owned(), master_key: None, env: "development".to_owned(), - #[cfg(feature = "analytics")] + #[cfg(all(not(debug_assertions), feature = "analytics"))] no_analytics: true, max_mdb_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(), max_udb_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(),