diff options
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/api/mod.rs b/src/api/mod.rs index 3233b16..ce1f6ae 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -9,7 +9,8 @@ mod stats; mod store; use axum::{ - Router, + Json, Router, + extract::State, http::{ HeaderValue, StatusCode, header::{CONTENT_TYPE, ETAG}, @@ -46,6 +47,7 @@ pub(crate) fn router(state: AppState, auth_state: AuthState, debug_api: bool) -> ) .route("/admin/stats", get(stats::get_stats)) .route("/admin/document", get(document::get_document)) + .route("/admin/config", get(get_config)) .merge(crate::remake::router::<AppState>()); if debug_api { @@ -63,6 +65,12 @@ pub(crate) fn router(state: AppState, auth_state: AuthState, debug_api: bool) -> .with_state(state) } +/// `GET /admin/config`: the effective configuration with each value's source; +/// imported values are left out. +async fn get_config(State(state): State<AppState>) -> Json<JsonValue> { + Json((*state.config).clone()) +} + // --- shared helpers ---------------------------------------------------------- pub(crate) fn store_status(error: StoreError, context: &str) -> StatusCode { |
