+ exchange-secmod config

This commit is contained in:
swrup 2025-11-20 21:07:15 +01:00
parent 9994385179
commit 97438d43ae
2 changed files with 43 additions and 35 deletions

View file

@ -3,11 +3,6 @@
do not support "$"-path expansion*)
(* TODO
- do all config section
- parse alt_unit_names json pair
*)
open Angstrom
type item = {
@ -287,7 +282,7 @@ module Config = struct
let read_file file = In_channel.with_open_bin file In_channel.input_all in
let content = read_file "default.config" in
let v = Parse_file.parse_content content in
(*Fmt.pr "config file:@\n%a@." Pp_debug.pp_config v;*)
(*Fmt.epr "config file:@\n%a@." Pp_debug.pp_config v;*)
v
module Exchange = struct
@ -321,6 +316,8 @@ module Config = struct
let signkey_legal_duration = get "signkey_legal_duration" |> duration
let max_keys_caching = get "max_keys_caching" |> duration
let enable_kyc = get "enable_kyc" |> yes_no
let terms_etag = get "terms_etag"
let privacy_etag = get "privacy_etag"
(* optional:
tiny_amount
@ -337,9 +334,7 @@ module Config = struct
unixpath
unixpath_mode
terms_dir
terms_etag
privacy_dir
privacy_etag *)
privacy_dir *)
end
module Exchangedb = struct
@ -404,13 +399,6 @@ module Config = struct
"section `[currency-%s]` not found, currency `%s` is not defined"
Exchange.currency Exchange.currency)
| Some v -> v
(*
let () =
let pp_pair ppf (k, v) = Fmt.pf ppf "k: %d - v: %s" k v in
Fmt.epr "alt unit names:@\n%a@." (Fmt.list pp_pair) v.alt_unit_names;
()
*)
end
module Coin = struct
@ -472,4 +460,32 @@ module Config = struct
let kudo_1 = get_coin "kudo_1"
let kudo_2 = get_coin "kudo_2"
end
module Make_exchange_secmod (M : sig
val kind : string
end) : sig
val lookahead_sign : Ptime.Span.t
val overlap_duration : Ptime.Span.t
end = struct
let get field =
let section = "taler-exchange-secmod-" ^ M.kind in
get config ~section ~field
let lookahead_sign = get "lookahead_sign" |> duration
let overlap_duration = get "overlap_duration" |> duration
(* not relevant:
sm_priv_key
key_dir
unixpath *)
end
module Exchange_secmod_rsa = Make_exchange_secmod (struct
let kind = "rsa"
end)
module Exchange_secmod_eddsa = Make_exchange_secmod (struct
let kind = "eddsa"
end)
(* not implemented: module Exchange_secmod_cs *)
end