mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-06-27 23:02:58 +02:00
24 lines
570 B
Rust
24 lines
570 B
Rust
use actix_web::{web, HttpResponse};
|
|
use serde::Serialize;
|
|
|
|
use crate::Data;
|
|
use crate::extractors::authentication::{GuardedData, policies::*};
|
|
|
|
pub fn services(cfg: &mut web::ServiceConfig) {
|
|
cfg.route("/keys", 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,
|
|
})
|
|
}
|