This commit is contained in:
swrup 2026-02-03 20:07:10 +01:00
parent 1af3718b1e
commit f1840ad9ac
2 changed files with 27 additions and 4 deletions

View file

@ -2,6 +2,9 @@ open Cmdliner
open Cmdliner.Term.Syntax open Cmdliner.Term.Syntax
open Offline_impl open Offline_impl
let base_url = Uri.of_string "http://localhost:3434/"
let default_master_offline_key_file = "data/master_offline_private_key"
module Arg = struct module Arg = struct
include Arg include Arg
@ -16,9 +19,16 @@ module Arg = struct
let amount = let amount =
Arg.Conv.make ~docv:"amount argument" ~parser:Amount.of_string ~pp:Amount.pp Arg.Conv.make ~docv:"amount argument" ~parser:Amount.of_string ~pp:Amount.pp
() ()
let url =
let parser path =
let full_url path =
Uri.with_path base_url path |> Uri.to_string
in
Arg.Conv.make ~docv:"amount argument" ~parser ~pp
()
end end
let default_master_offline_key_file = "data/master_offline_private_key"
(* (*
let default_response_file = "response.json" let default_response_file = "response.json"
let default_request_file = "request.json" let default_request_file = "request.json"
@ -103,6 +113,18 @@ let revoke_signkey_cmd =
let+ output = output and+ master_key = master_key and+ signkey = signkey in let+ output = output and+ master_key = master_key and+ signkey = signkey in
revoke_signkey ~output ~master_key ~signkey revoke_signkey ~output ~master_key ~signkey
let enable_auditor_cmd =
let doc = "Enable an auditor." in
let auditor_url =
Arg.(required & opt (some url) None & info [ "auditor_url" ])
in
Cmd.make (Cmd.info "global-fees" ~doc)
@@
let+ output = output
and+ master_key = master_key
and+ auditor_url = auditor_url in
enable_auditor ~output ~master_key ~auditor_url
let global_fees_cmd = let global_fees_cmd =
let doc = "Provides global fee configuration." in let doc = "Provides global fee configuration." in
let start_date = let start_date =

View file

@ -9,9 +9,6 @@ let read_master_key_file filename =
let* master_key = read_file filename in let* master_key = read_file filename in
Crypto.EddsaPrivateKey.of_octets master_key Crypto.EddsaPrivateKey.of_octets master_key
let base_url = Uri.of_string "http://localhost:3434/"
let full_url path = Uri.with_path base_url path |> Uri.to_string
let download ~output = let download ~output =
let open Bos in let open Bos in
let uri = full_url "/management/keys/" in let uri = full_url "/management/keys/" in
@ -135,3 +132,7 @@ let global_fees ~output ~master_key ~start_date ~end_date ~history_fee
let* s = Api.encode Api.GlobalFees.jsont global_fees in let* s = Api.encode Api.GlobalFees.jsont global_fees in
let* () = write_file output s in let* () = write_file output s in
Ok () Ok ()
[@@@ocaml.warning "-27"]
let enable_auditor ~output ~master_key ~auditor_url = assert false