This commit is contained in:
2025-04-20 09:48:49 +02:00
parent ec6da0b4e0
commit 0518ddb93d
7 changed files with 230 additions and 234 deletions

View File

@@ -10,6 +10,7 @@ use serde_json::json;
use log::{error, info};
use utoipa::OpenApi;
use utoipa_redoc::{Redoc, Servable};
use utoipa_swagger_ui::SwaggerUi;
use crate::ACLDB;
use crate::rpc::{RpcInterface, RpcRequest, RpcResponse, AclUpdateParams, AclRemoveParams, AclDelParams, SetParams, DelParams, GetParams, PrefixParams};
@@ -165,6 +166,7 @@ impl Server {
info!("Starting ACLDB server on {}:{}", self.config.host, self.config.port);
info!("API documentation available at: http://{}:{}/redoc", self.config.host, self.config.port);
info!("Swagger UI available at: http://{}:{}/swagger", self.config.host, self.config.port);
// Start the HTTP server
HttpServer::new(move || {
@@ -182,6 +184,10 @@ impl Server {
.service(
Redoc::with_url("/redoc", serde_json::to_value(ApiDoc::openapi()).unwrap())
)
.service(
SwaggerUi::new("/swagger/{_:.*}")
.url("/api-docs/openapi.json", ApiDoc::openapi())
)
})
.bind(format!("{0}:{1}", self.config.host, self.config.port))?
.run()