diff options
| author | tv <tv@krebsco.de> | 2026-10-31 03:58:59 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 03:58:59 +0100 |
| commit | 8504613653a5979c41256364274213e325f527c2 (patch) | |
| tree | 923e8daff9f5c96f65a8f0da1d5a5c9f5903bbaf /src/api/config.rs | |
| parent | 16957af7eb771d492af9c4fd8e50b765d3e597a1 (diff) | |
move /admin/config handler to own module
Diffstat (limited to 'src/api/config.rs')
| -rw-r--r-- | src/api/config.rs | 25 |
1 files changed, 25 insertions, 0 deletions
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<AppState>, + Query(query): Query<ConfigQuery>, +) -> Json<JsonValue> { + Json(state.config.get(query.values).clone()) +} |
