From 435778f3284633eb6161c8ff3bfd5c1d522ae878 Mon Sep 17 00:00:00 2001 From: Fall1ngStar Date: Wed, 5 Oct 2022 20:14:37 -0400 Subject: [PATCH 1/2] Change default bind address to localhost --- meilisearch-http/src/analytics/segment_analytics.rs | 2 +- meilisearch-http/src/option.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meilisearch-http/src/analytics/segment_analytics.rs b/meilisearch-http/src/analytics/segment_analytics.rs index dd14629c3..7d7ceb08e 100644 --- a/meilisearch-http/src/analytics/segment_analytics.rs +++ b/meilisearch-http/src/analytics/segment_analytics.rs @@ -235,7 +235,7 @@ impl Segment { let dumps_dir = opt.dumps_dir != PathBuf::from("dumps/"); let import_snapshot = opt.import_snapshot.is_some(); let snapshots_dir = opt.snapshot_dir != PathBuf::from("snapshots/"); - let http_addr = opt.http_addr != "127.0.0.1:7700"; + let http_addr = opt.http_addr != default_http_addr(); let mut infos = serde_json::to_value(opt).unwrap(); diff --git a/meilisearch-http/src/option.rs b/meilisearch-http/src/option.rs index ae12f0cc6..ebe5a7293 100644 --- a/meilisearch-http/src/option.rs +++ b/meilisearch-http/src/option.rs @@ -52,7 +52,7 @@ const MEILI_LOG_LEVEL: &str = "MEILI_LOG_LEVEL"; const MEILI_ENABLE_METRICS_ROUTE: &str = "MEILI_ENABLE_METRICS_ROUTE"; const DEFAULT_DB_PATH: &str = "./data.ms"; -const DEFAULT_HTTP_ADDR: &str = "127.0.0.1:7700"; +const DEFAULT_HTTP_ADDR: &str = "localhost:7700"; const DEFAULT_ENV: &str = "development"; const DEFAULT_MAX_INDEX_SIZE: &str = "100 GiB"; const DEFAULT_MAX_TASK_DB_SIZE: &str = "100 GiB"; From d1c10d6d681fab4d47615abb49cee6faed13d859 Mon Sep 17 00:00:00 2001 From: Fall1ngStar Date: Thu, 6 Oct 2022 22:42:20 -0400 Subject: [PATCH 2/2] Fix segment_analytics default_http_addr import --- meilisearch-http/src/analytics/segment_analytics.rs | 1 + meilisearch-http/src/option.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/meilisearch-http/src/analytics/segment_analytics.rs b/meilisearch-http/src/analytics/segment_analytics.rs index 7d7ceb08e..e4dfac217 100644 --- a/meilisearch-http/src/analytics/segment_analytics.rs +++ b/meilisearch-http/src/analytics/segment_analytics.rs @@ -26,6 +26,7 @@ use tokio::sync::mpsc::{self, Receiver, Sender}; use uuid::Uuid; use crate::analytics::Analytics; +use crate::option::default_http_addr; use crate::routes::indexes::documents::UpdateDocumentsQuery; use crate::Opt; diff --git a/meilisearch-http/src/option.rs b/meilisearch-http/src/option.rs index ebe5a7293..65e3c8381 100644 --- a/meilisearch-http/src/option.rs +++ b/meilisearch-http/src/option.rs @@ -465,7 +465,7 @@ fn default_db_path() -> PathBuf { PathBuf::from(DEFAULT_DB_PATH) } -fn default_http_addr() -> String { +pub fn default_http_addr() -> String { DEFAULT_HTTP_ADDR.to_string() }