Release: NX9-Auth v0.3.0
This commit is contained in:
1 parent
6a04d7f793
commit
d93f2cef95
92 files changed
+2418
-1143
No files matched your search
+13
-2
@@ -1,15 +1,26 @@
|
||||
use axum::Json;
|
||||
use axum::extract::State;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::state::AppState;
|
||||
|
||||
/// GET /version
|
||||
///
|
||||
/// Returns build metadata baked in at compile time via `build.rs`.
|
||||
pub async fn version() -> Json<Value> {
|
||||
/// Returns build metadata baked in at compile time via `build.rs` and active db_backend.
|
||||
pub async fn version(State(state): State<AppState>) -> Json<Value> {
|
||||
let backend = state
|
||||
.config
|
||||
.database
|
||||
.resolved_url()
|
||||
.map(|(_, b)| b.to_string())
|
||||
.unwrap_or_else(|_| "unknown".to_string());
|
||||
|
||||
Json(json!({
|
||||
"name": env!("CARGO_PKG_NAME"),
|
||||
"version": env!("CARGO_PKG_VERSION"),
|
||||
"git_commit": env!("GIT_COMMIT"),
|
||||
"build_date": env!("BUILD_DATE"),
|
||||
"rust_version": env!("RUST_VERSION"),
|
||||
"db_backend": backend,
|
||||
}))
|
||||
}
|
||||
Reference in new issue
Block a user