Skip to content

Commit

Permalink
Add inner docs for new rpc module
Browse files Browse the repository at this point in the history
  • Loading branch information
IAvecilla committed Jan 23, 2024
1 parent 88a5b23 commit 890bdee
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion node/tools/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async fn main() -> anyhow::Result<()> {

// Config for the RPC server.
let mut rpc_addr = configs.app.public_addr.to_string();
rpc_addr.replace_range(rpc_addr.find(":").unwrap().., ":3051");
rpc_addr.replace_range(rpc_addr.find(':').unwrap().., ":3051");

// Initialize the storage.
scope::run!(ctx, |ctx, s| async {
Expand Down
7 changes: 5 additions & 2 deletions node/tools/src/rpc/methods/health_check.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//! Health check method for RPC server.
use jsonrpsee::types::Params;

pub fn callback(_params: Params) -> serde_json::Value {
/// Health check response for /health endpoint.
pub(crate) fn callback(_params: Params) -> serde_json::Value {
serde_json::json!({"health": true})
}

pub fn method() -> &'static str {
/// Health check method name.
pub(crate) fn method() -> &'static str {
"health_check"
}
1 change: 1 addition & 0 deletions node/tools/src/rpc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
//! RPC server for testing purposes.
mod methods;
pub mod server;
2 changes: 1 addition & 1 deletion node/tools/src/rpc/server.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::net::SocketAddr;

use jsonrpsee::server::{middleware::http::ProxyGetRequestLayer, RpcModule, Server};
use super::methods::health_check;
use jsonrpsee::server::{middleware::http::ProxyGetRequestLayer, RpcModule, Server};

pub async fn run_server(ip_address: String) -> anyhow::Result<()> {
let ip_address: SocketAddr = ip_address.parse()?;
Expand Down

0 comments on commit 890bdee

Please sign in to comment.