blob: 10a9f80bd1e1c3241afdaec705a8ef31f6e8338f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
//! `GET /admin/config`: the effective configuration, as `--print-config` prints it.
use axum::{
Json,
extract::{Query, State},
};
use serde_json::Value as JsonValue;
use crate::state::AppState;
#[derive(Debug, Default, serde::Deserialize)]
pub(crate) struct ConfigQuery {
/// Text with placeholders as it ends up, or as written.
#[serde(default)]
values: crate::config::Values,
}
/// `GET /admin/config`: the effective configuration with each value's source;
/// imported values and secrets are left out.
pub(crate) async fn get_config(
State(state): State<AppState>,
Query(query): Query<ConfigQuery>,
) -> Json<JsonValue> {
Json(state.config.get(query.values).clone())
}
|