colibri.qdrant / src /actix /api /debug_api.rs
Gouzi Mohaled
Ajout du dossier src
d8435ba
use actix_web::{get, patch, web, Responder};
use storage::rbac::AccessRequirements;
use crate::actix::auth::ActixAccess;
use crate::common::debugger::{DebugConfigPatch, DebuggerState};
#[get("/debugger")]
async fn get_debugger_config(
ActixAccess(access): ActixAccess,
debugger_state: web::Data<DebuggerState>,
) -> impl Responder {
crate::actix::helpers::time(async move {
access.check_global_access(AccessRequirements::new().manage())?;
Ok(debugger_state.get_config())
})
.await
}
#[patch("/debugger")]
async fn update_debugger_config(
ActixAccess(access): ActixAccess,
debugger_state: web::Data<DebuggerState>,
debug_patch: web::Json<DebugConfigPatch>,
) -> impl Responder {
crate::actix::helpers::time(async move {
access.check_global_access(AccessRequirements::new().manage())?;
Ok(debugger_state.apply_config_patch(debug_patch.into_inner()))
})
.await
}
// Configure services
pub fn config_debugger_api(cfg: &mut web::ServiceConfig) {
cfg.service(get_debugger_config);
cfg.service(update_debugger_config);
}