From 14b90ffbf91595c347376bf2f7f6a772aa19fdb5 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 8 Jan 2024 10:40:29 +0100 Subject: [PATCH] httpd: Change node id in `/` and add version to `/node` --- radicle-httpd/src/api/v1.rs | 2 +- radicle-httpd/src/api/v1/node.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/radicle-httpd/src/api/v1.rs b/radicle-httpd/src/api/v1.rs index 189a2220..437cc715 100644 --- a/radicle-httpd/src/api/v1.rs +++ b/radicle-httpd/src/api/v1.rs @@ -35,7 +35,7 @@ async fn root_handler(State(ctx): State) -> 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": [ { diff --git a/radicle-httpd/src/api/v1/node.rs b/radicle-httpd/src/api/v1/node.rs index 2c004ca0..ae100f6a 100644 --- a/radicle-httpd/src/api/v1/node.rs +++ b/radicle-httpd/src/api/v1/node.rs @@ -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) -> impl IntoResponse { }; let response = json!({ "id": node_id.to_string(), + "version": format!("{}-{}", VERSION, env!("GIT_HEAD")), "config": config, "state": node_state, });