mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +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::delete_documents)
|
||||
.service(routes::document::clear_all_documents)
|
||||
.service(routes::key::list)
|
||||
.service(routes::health::get_health)
|
||||
.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 serde_json::json;
|
||||
use tide::{Request, Response};
|
||||
use actix_web::*;
|
||||
|
||||
pub async fn list(ctx: Request<Data>) -> SResult<Response> {
|
||||
ctx.is_allowed(Admin)?;
|
||||
#[get("/keys")]
|
||||
pub async fn list(
|
||||
data: web::Data<Data>,
|
||||
) -> Result<HttpResponse> {
|
||||
let keys = &data.api_keys;
|
||||
|
||||
let keys = &ctx.state().api_keys;
|
||||
|
||||
Ok(tide::Response::new(200).body_json(&json!({
|
||||
HttpResponse::Ok().json(&json!({
|
||||
"private": keys.private,
|
||||
"public": keys.public,
|
||||
}))?)
|
||||
})).await
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use serde::Serialize;
|
||||
pub mod document;
|
||||
pub mod health;
|
||||
// pub mod index;
|
||||
// pub mod key;
|
||||
pub mod key;
|
||||
// pub mod search;
|
||||
// pub mod setting;
|
||||
// pub mod stats;
|
||||
|
Loading…
x
Reference in New Issue
Block a user