From 6a1820513f1e15ea53bc639e901101c87ab32788 Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Wed, 10 Apr 2024 23:58:28 +0530 Subject: [PATCH 1/3] fix for GET /cache API --- server/src/handlers/http/modal/server.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server/src/handlers/http/modal/server.rs b/server/src/handlers/http/modal/server.rs index ceb03b14f..4d72bd9af 100644 --- a/server/src/handlers/http/modal/server.rs +++ b/server/src/handlers/http/modal/server.rs @@ -274,10 +274,7 @@ impl Server { web::put() .to(logstream::put_enable_cache) .authorize_for_stream(Action::PutCacheEnabled), - ), - ) - .service( - web::resource("/cache") + ) // GET "/logstream/{logstream}/cache" ==> Get retention for given logstream .route( web::get() From d29d373b41d44e3b2684528e5ed9d45d46494e0f Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Thu, 11 Apr 2024 00:22:03 +0530 Subject: [PATCH 2/3] fixed P_INGESTOR_URL fetch from env variables --- server/src/utils.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/server/src/utils.rs b/server/src/utils.rs index 7ad6a14e1..d84eaa41b 100644 --- a/server/src/utils.rs +++ b/server/src/utils.rs @@ -237,14 +237,21 @@ pub fn get_address() -> SocketAddr { let mut hostname = addr_from_env[0].to_string(); let mut port = addr_from_env[1].to_string(); - if hostname.starts_with('$') && port.starts_with('$') { - hostname = get_from_env("HOSTNAME"); - port = get_from_env("PORT"); - let addr = format!("{}:{}", hostname, port); - addr.parse::().unwrap() + if hostname.starts_with('$') { + let var_hostname = hostname[1..].to_string(); + hostname = get_from_env(&var_hostname); } else { - CONFIG.parseable.ingestor_url.parse::().unwrap() + hostname = hostname.to_string(); } + if port.starts_with('$') { + let var_port = port[1..].to_string(); + port = get_from_env(&var_port); + } else { + hostname = hostname.to_string(); + } + format!("{}:{}", hostname, port) + .parse::() + .unwrap() } } fn get_from_env(var_to_fetch: &str) -> String { From fe350f3ba15c47837ed5d614e4659a7663ef2186 Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Thu, 11 Apr 2024 00:26:55 +0530 Subject: [PATCH 3/3] removed unnecessary else from server url func --- server/src/utils.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/src/utils.rs b/server/src/utils.rs index d84eaa41b..d1cf6a155 100644 --- a/server/src/utils.rs +++ b/server/src/utils.rs @@ -240,14 +240,10 @@ pub fn get_address() -> SocketAddr { if hostname.starts_with('$') { let var_hostname = hostname[1..].to_string(); hostname = get_from_env(&var_hostname); - } else { - hostname = hostname.to_string(); } if port.starts_with('$') { let var_port = port[1..].to_string(); port = get_from_env(&var_port); - } else { - hostname = hostname.to_string(); } format!("{}:{}", hostname, port) .parse::()