From 1956045a0619c5f80551c6f662823158f0b6974b Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 27 Nov 2023 14:45:18 +0100 Subject: [PATCH] add the option --- meilisearch/src/analytics/segment_analytics.rs | 1 + meilisearch/src/option.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/meilisearch/src/analytics/segment_analytics.rs b/meilisearch/src/analytics/segment_analytics.rs index 1ad277c28..6a617577b 100644 --- a/meilisearch/src/analytics/segment_analytics.rs +++ b/meilisearch/src/analytics/segment_analytics.rs @@ -290,6 +290,7 @@ impl From for Infos { http_addr, master_key: _, env, + task_webhook_url: _, max_index_size: _, max_task_db_size: _, http_payload_size_limit, diff --git a/meilisearch/src/option.rs b/meilisearch/src/option.rs index 1ed20f5b5..37472e174 100644 --- a/meilisearch/src/option.rs +++ b/meilisearch/src/option.rs @@ -28,6 +28,7 @@ const MEILI_DB_PATH: &str = "MEILI_DB_PATH"; const MEILI_HTTP_ADDR: &str = "MEILI_HTTP_ADDR"; const MEILI_MASTER_KEY: &str = "MEILI_MASTER_KEY"; const MEILI_ENV: &str = "MEILI_ENV"; +const MEILI_TASK_WEBHOOK_URL: &str = "MEILI_TASK_WEBHOOK_URL"; #[cfg(feature = "analytics")] const MEILI_NO_ANALYTICS: &str = "MEILI_NO_ANALYTICS"; const MEILI_HTTP_PAYLOAD_SIZE_LIMIT: &str = "MEILI_HTTP_PAYLOAD_SIZE_LIMIT"; @@ -156,6 +157,10 @@ pub struct Opt { #[serde(default = "default_env")] pub env: String, + /// Called whenever a task finishes so a third party can be notified. + #[clap(long, env = MEILI_TASK_WEBHOOK_URL)] + pub task_webhook_url: Option, + /// Deactivates Meilisearch's built-in telemetry when provided. /// /// Meilisearch automatically collects data from all instances that do not opt out using this flag. @@ -375,6 +380,7 @@ impl Opt { http_addr, master_key, env, + task_webhook_url, max_index_size: _, max_task_db_size: _, http_payload_size_limit, @@ -409,6 +415,10 @@ impl Opt { export_to_env_if_not_present(MEILI_MASTER_KEY, master_key); } export_to_env_if_not_present(MEILI_ENV, env); + if let Some(task_webhook_url) = task_webhook_url { + export_to_env_if_not_present(MEILI_TASK_WEBHOOK_URL, task_webhook_url); + } + #[cfg(feature = "analytics")] { export_to_env_if_not_present(MEILI_NO_ANALYTICS, no_analytics.to_string());