...
This commit is contained in:
@@ -9,7 +9,7 @@ use tokio::sync::RwLock;
|
||||
use serde_json::json;
|
||||
use log::{error, info};
|
||||
use utoipa::OpenApi;
|
||||
use utoipa_swagger_ui::SwaggerUi;
|
||||
use utoipa_redoc::{Redoc, Servable};
|
||||
|
||||
use crate::ACLDB;
|
||||
use crate::rpc::{RpcInterface, RpcRequest, RpcResponse, AclUpdateParams, AclRemoveParams, AclDelParams, SetParams, DelParams, GetParams, PrefixParams};
|
||||
@@ -164,7 +164,7 @@ impl Server {
|
||||
self.register_handlers();
|
||||
|
||||
info!("Starting ACLDB server on {}:{}", self.config.host, self.config.port);
|
||||
info!("Swagger UI available at: http://{}:{}/swagger-ui/", self.config.host, self.config.port);
|
||||
info!("API documentation available at: http://{}:{}/redoc", self.config.host, self.config.port);
|
||||
|
||||
// Start the HTTP server
|
||||
HttpServer::new(move || {
|
||||
@@ -180,8 +180,7 @@ impl Server {
|
||||
.route("/rpc", web::post().to(handle_rpc))
|
||||
.route("/health", web::get().to(health_check))
|
||||
.service(
|
||||
SwaggerUi::new("/swagger-ui/{_:.*}")
|
||||
.url("/api-docs/openapi.json", ApiDoc::openapi())
|
||||
Redoc::with_url("/redoc", serde_json::to_value(ApiDoc::openapi()).unwrap())
|
||||
)
|
||||
})
|
||||
.bind(format!("{0}:{1}", self.config.host, self.config.port))?
|
||||
@@ -311,7 +310,7 @@ async fn handle_rpc(
|
||||
/// Process an RPC request
|
||||
async fn process_request(
|
||||
request: &RpcRequest,
|
||||
rpc_interface: &Arc<RpcInterface>,
|
||||
_rpc_interface: &Arc<RpcInterface>,
|
||||
acldb_factory: &Arc<ACLDBFactory>
|
||||
) -> RpcResponse {
|
||||
match request.method.as_str() {
|
||||
|
Reference in New Issue
Block a user