mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 06:44:27 +01:00
add key endpoint
This commit is contained in:
parent
540308dc63
commit
0aa16dd3b1
@ -63,6 +63,7 @@ async fn main() -> Result<(), MainError> {
|
|||||||
.service(routes::document::update_documents)
|
.service(routes::document::update_documents)
|
||||||
.service(routes::document::delete_documents)
|
.service(routes::document::delete_documents)
|
||||||
.service(routes::document::clear_all_documents)
|
.service(routes::document::clear_all_documents)
|
||||||
|
.service(routes::key::list)
|
||||||
.service(routes::health::get_health)
|
.service(routes::health::get_health)
|
||||||
.service(routes::health::change_healthyness)
|
.service(routes::health::change_healthyness)
|
||||||
)
|
)
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
use crate::error::SResult;
|
|
||||||
use crate::helpers::tide::RequestExt;
|
|
||||||
use crate::helpers::tide::ACL::*;
|
|
||||||
use crate::Data;
|
use crate::Data;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use tide::{Request, Response};
|
use actix_web::*;
|
||||||
|
|
||||||
pub async fn list(ctx: Request<Data>) -> SResult<Response> {
|
#[get("/keys")]
|
||||||
ctx.is_allowed(Admin)?;
|
pub async fn list(
|
||||||
|
data: web::Data<Data>,
|
||||||
|
) -> Result<HttpResponse> {
|
||||||
|
let keys = &data.api_keys;
|
||||||
|
|
||||||
let keys = &ctx.state().api_keys;
|
HttpResponse::Ok().json(&json!({
|
||||||
|
|
||||||
Ok(tide::Response::new(200).body_json(&json!({
|
|
||||||
"private": keys.private,
|
"private": keys.private,
|
||||||
"public": keys.public,
|
"public": keys.public,
|
||||||
}))?)
|
})).await
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ use serde::Serialize;
|
|||||||
pub mod document;
|
pub mod document;
|
||||||
pub mod health;
|
pub mod health;
|
||||||
// pub mod index;
|
// pub mod index;
|
||||||
// pub mod key;
|
pub mod key;
|
||||||
// pub mod search;
|
// pub mod search;
|
||||||
// pub mod setting;
|
// pub mod setting;
|
||||||
// pub mod stats;
|
// pub mod stats;
|
||||||
|
Loading…
Reference in New Issue
Block a user