add the option

This commit is contained in:
Tamo 2023-11-27 14:45:18 +01:00 committed by Clément Renault
parent 248aaa6d45
commit 1956045a06
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
2 changed files with 11 additions and 0 deletions

View File

@ -290,6 +290,7 @@ impl From<Opt> for Infos {
http_addr,
master_key: _,
env,
task_webhook_url: _,
max_index_size: _,
max_task_db_size: _,
http_payload_size_limit,

View File

@ -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<String>,
/// 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());