mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
fix: admin api prefix: /rustfs/admin
fix #91 Signed-off-by: bestgopher <84328409@qq.com>
This commit is contained in:
@@ -11,11 +11,16 @@ use tower::Service;
|
|||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, ErrorCode>;
|
pub type Result<T> = std::result::Result<T, ErrorCode>;
|
||||||
|
|
||||||
|
const API_VERSION: &str = "/v3";
|
||||||
|
|
||||||
pub fn register_admin_router(
|
pub fn register_admin_router(
|
||||||
ec_store: Option<ECStore>,
|
ec_store: Option<ECStore>,
|
||||||
) -> impl Service<Request, Response = Response, Error: Into<BoxError>, Future: Send> + Clone {
|
) -> impl Service<Request, Response = Response, Error: Into<BoxError>, Future: Send> + Clone {
|
||||||
Router::new()
|
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))
|
.with_state::<()>(ObjectApi::new(ec_store))
|
||||||
.into_service()
|
.into_service()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ where
|
|||||||
grpc_future: self.grpc.call(req),
|
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({
|
admin_future: self.admin.call({
|
||||||
let (parts, body) = req.into_parts();
|
let (parts, body) = req.into_parts();
|
||||||
Request::from_parts(parts, Body::new(body).into())
|
Request::from_parts(parts, Body::new(body).into())
|
||||||
|
|||||||
Reference in New Issue
Block a user