httpd: Change node id in `/` and add version to `/node`

This commit is contained in:
Sebastian Martinez 2024-01-08 10:40:29 +01:00 committed by cloudhead
parent 9b98542692
commit 14b90ffbf9
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View File

@ -35,7 +35,7 @@ async fn root_handler(State(ctx): State<Context>) -> impl IntoResponse {
"message": "Welcome!",
"service": "radicle-httpd",
"version": format!("{}-{}", VERSION, env!("GIT_HEAD")),
"node": { "id": ctx.profile.public_key },
"nid": ctx.profile.public_key,
"path": "/api/v1",
"links": [
{

View File

@ -11,7 +11,7 @@ use radicle::node::{policy, Handle, DEFAULT_TIMEOUT};
use radicle::Node;
use crate::api::error::Error;
use crate::api::{self, Context, PoliciesQuery};
use crate::api::{self, Context, PoliciesQuery, VERSION};
use crate::axum_extra::{Path, Query};
pub fn router(ctx: Context) -> Router {
@ -44,6 +44,7 @@ async fn node_handler(State(ctx): State<Context>) -> impl IntoResponse {
};
let response = json!({
"id": node_id.to_string(),
"version": format!("{}-{}", VERSION, env!("GIT_HEAD")),
"config": config,
"state": node_state,
});