diff --git a/meilisearch-http/src/main.rs b/meilisearch-http/src/main.rs
index 27c310f3a..955321a6f 100644
--- a/meilisearch-http/src/main.rs
+++ b/meilisearch-http/src/main.rs
@@ -50,7 +50,7 @@ async fn main() -> anyhow::Result<()> {
let auth_controller = AuthController::new(&opt.db_path, &opt.master_key)?;
#[cfg(all(not(debug_assertions), feature = "analytics"))]
- let (analytics, user) = if !opt.no_analytics {
+ let (analytics, user) = if opt.analytics() {
analytics::SegmentAnalytics::new(&opt, &meilisearch).await
} else {
analytics::MockAnalytics::new(&opt)
@@ -125,9 +125,7 @@ pub fn print_launch_resume(opt: &Opt, user: &str) {
#[cfg(all(not(debug_assertions), feature = "analytics"))]
{
- if opt.no_analytics {
- eprintln!("Anonymous telemetry:\t\"Disabled\"");
- } else {
+ if opt.analytics() {
eprintln!(
"
Thank you for using MeiliSearch!
@@ -136,6 +134,8 @@ We collect anonymized analytics to improve our product and your experience. To l
Anonymous telemetry:\t\"Enabled\""
);
+ } else {
+ eprintln!("Anonymous telemetry:\t\"Disabled\"");
}
}
diff --git a/meilisearch-http/src/option.rs b/meilisearch-http/src/option.rs
index d6b2a39dd..c6f783074 100644
--- a/meilisearch-http/src/option.rs
+++ b/meilisearch-http/src/option.rs
@@ -38,7 +38,7 @@ pub struct Opt {
/// Do not send analytics to Meili.
#[cfg(all(not(debug_assertions), feature = "analytics"))]
#[structopt(long, env = "MEILI_NO_ANALYTICS")]
- pub no_analytics: bool,
+ pub no_analytics: Option