mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-06-17 10:00:03 +02:00
24 lines
593 B
Rust
24 lines
593 B
Rust
use actix_web::{web, HttpResponse};
|
|
use serde::Serialize;
|
|
|
|
use crate::extractors::authentication::{policies::*, GuardedData};
|
|
use crate::Data;
|
|
|
|
pub fn services(cfg: &mut web::ServiceConfig) {
|
|
cfg.service(web::resource("/keys").route(web::get().to(list)));
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
struct KeysResponse {
|
|
private: Option<String>,
|
|
public: Option<String>,
|
|
}
|
|
|
|
async fn list(data: GuardedData<Admin, Data>) -> HttpResponse {
|
|
let api_keys = data.api_keys.clone();
|
|
HttpResponse::Ok().json(&KeysResponse {
|
|
private: api_keys.private,
|
|
public: api_keys.public,
|
|
})
|
|
}
|