Add /monitor/commit_hash RPC

This commit is contained in:
Sebastien Mondet 2019-02-25 16:58:36 -05:00
parent b4e6018dd1
commit e9eac31e9a
3 changed files with 18 additions and 0 deletions

View File

@ -147,4 +147,8 @@ let build_rpc_directory validator mainchain_validator =
RPC_answer.return_stream { next ; shutdown } RPC_answer.return_stream { next ; shutdown }
end ; end ;
gen_register0 Monitor_services.S.commit_hash begin fun () () ->
RPC_answer.return Tezos_base.Current_git_info.commit_hash
end ;
!dir !dir

View File

@ -100,6 +100,13 @@ module S = struct
~output: Protocol_hash.encoding ~output: Protocol_hash.encoding
RPC_path.(path / "protocols") 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 end
open RPC_context open RPC_context
@ -122,3 +129,6 @@ let heads ctxt ?(next_protocols = []) chain =
let protocols ctxt = let protocols ctxt =
make_streamed_call S.protocols ctxt () () () make_streamed_call S.protocols ctxt () () ()
let commit_hash ctxt =
make_call S.commit_hash ctxt () () ()

View File

@ -45,6 +45,8 @@ val protocols:
#streamed -> #streamed ->
(Protocol_hash.t Lwt_stream.t * stopper) tzresult Lwt.t (Protocol_hash.t Lwt_stream.t * stopper) tzresult Lwt.t
val commit_hash: #simple -> string tzresult Lwt.t
module S : sig module S : sig
val bootstrapped: val bootstrapped:
@ -70,5 +72,7 @@ module S : sig
unit, unit, unit, unit, unit, unit,
Protocol_hash.t) RPC_service.t Protocol_hash.t) RPC_service.t
val commit_hash:
([ `GET ], unit, unit, unit, unit, string) RPC_service.t
end end