From 8504613653a5979c41256364274213e325f527c2 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 03:58:59 +0100 Subject: move /admin/config handler to own module --- src/api/config.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/api/config.rs (limited to 'src/api/config.rs') diff --git a/src/api/config.rs b/src/api/config.rs new file mode 100644 index 0000000..10a9f80 --- /dev/null +++ b/src/api/config.rs @@ -0,0 +1,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, + Query(query): Query, +) -> Json { + Json(state.config.get(query.values).clone()) +} -- cgit v1.3.1