From f9b6b88a96c29b2706ed24d3c5f05a135a4f22db Mon Sep 17 00:00:00 2001 From: bestgopher <84328409@qq.com> Date: Wed, 16 Oct 2024 22:41:31 +0800 Subject: [PATCH] fix: admin api prefix: /rustfs/admin fix #91 Signed-off-by: bestgopher <84328409@qq.com> --- api/admin/src/lib.rs | 7 ++++++- rustfs/src/service.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/admin/src/lib.rs b/api/admin/src/lib.rs index 58b7163df..b04621748 100644 --- a/api/admin/src/lib.rs +++ b/api/admin/src/lib.rs @@ -11,11 +11,16 @@ use tower::Service; pub type Result = std::result::Result; +const API_VERSION: &str = "/v3"; + pub fn register_admin_router( ec_store: Option, ) -> impl Service, Future: Send> + Clone { Router::new() - .nest("/admin/v3", Router::new().route("/pools/list", get(list_pools::handler))) + .nest( + "/rustfs/admin", + Router::new().nest(API_VERSION, Router::new().route("/pools/list", get(list_pools::handler))), + ) .with_state::<()>(ObjectApi::new(ec_store)) .into_service() } diff --git a/rustfs/src/service.rs b/rustfs/src/service.rs index 049ec94e3..4e47fb970 100644 --- a/rustfs/src/service.rs +++ b/rustfs/src/service.rs @@ -72,7 +72,7 @@ where grpc_future: self.grpc.call(req), }, - _ if req.uri().path().starts_with("/admin/v3") => HybridFuture::Admin { + _ if req.uri().path().starts_with("/rustfs") => HybridFuture::Admin { admin_future: self.admin.call({ let (parts, body) = req.into_parts(); Request::from_parts(parts, Body::new(body).into())