diff --git a/src/lib_shell/monitor_directory.ml b/src/lib_shell/monitor_directory.ml index 00df8668b..d5bb392b1 100644 --- a/src/lib_shell/monitor_directory.ml +++ b/src/lib_shell/monitor_directory.ml @@ -147,4 +147,8 @@ let build_rpc_directory validator mainchain_validator = RPC_answer.return_stream { next ; shutdown } end ; + gen_register0 Monitor_services.S.commit_hash begin fun () () -> + RPC_answer.return Tezos_base.Current_git_info.commit_hash + end ; + !dir diff --git a/src/lib_shell_services/monitor_services.ml b/src/lib_shell_services/monitor_services.ml index f6821432e..db0ffffc0 100644 --- a/src/lib_shell_services/monitor_services.ml +++ b/src/lib_shell_services/monitor_services.ml @@ -100,6 +100,13 @@ module S = struct ~output: Protocol_hash.encoding RPC_path.(path / "protocols") + let commit_hash = + RPC_service.get_service + ~description:"Get information on the build of the node." + ~query: RPC_query.empty + ~output: string + RPC_path.(path / "commit_hash") + end open RPC_context @@ -122,3 +129,6 @@ let heads ctxt ?(next_protocols = []) chain = let protocols ctxt = make_streamed_call S.protocols ctxt () () () + +let commit_hash ctxt = + make_call S.commit_hash ctxt () () () diff --git a/src/lib_shell_services/monitor_services.mli b/src/lib_shell_services/monitor_services.mli index 6c194b648..c64af75d3 100644 --- a/src/lib_shell_services/monitor_services.mli +++ b/src/lib_shell_services/monitor_services.mli @@ -45,6 +45,8 @@ val protocols: #streamed -> (Protocol_hash.t Lwt_stream.t * stopper) tzresult Lwt.t +val commit_hash: #simple -> string tzresult Lwt.t + module S : sig val bootstrapped: @@ -70,5 +72,7 @@ module S : sig unit, unit, unit, Protocol_hash.t) RPC_service.t + val commit_hash: + ([ `GET ], unit, unit, unit, unit, string) RPC_service.t end