diff --git a/default.config b/default.config index fb795207..0c401640 100644 --- a/default.config +++ b/default.config @@ -1,23 +1,5 @@ -# comment 1 -# foo -# barr [currency-EUR] -enabled = NO - # comment 2 -code= "EUR" -name =euro -fractional_input_digits = 2 -fractional_normal_digits =2 -fractional_trailing_zero_digits= 2 - % comment 3 -alt_unit_names = "{"0":"€","3":"k€"}" -% comment 4 - -[dummy-section] -dummy = "blah" - -[currency-EUR] -enabled= NO +enabled= YES code= EUR name= euro fractional_input_digits= 2 @@ -43,6 +25,8 @@ wirewatch_idle_sleep_interval = "1 hour" signkey_legal_duration = "1 year" max_keys_caching = "4 weeks" enable_kyc = NO +terms_etag = "0" +privacy_etag = "0" [exchangedb] idle_reserve_expiration_time = "1 year 2 weeks 3 hours 4 minutes 5 seconds" @@ -54,6 +38,14 @@ default_purse_limit = 9999 [exchangedb-postgres] config = "pgx://mte:hunter2@localhost:5432/taler-exchange" +[taler-exchange-secmod-rsa] +lookahead_sign = "1 year" +overlap_duration = "1 year" + +[taler-exchange-secmod-eddsa] +lookahead_sign = "1 year" +overlap_duration = "1 year" + [coin_kudo_1] value= EUR:0.01 duration_withdraw= "1 year" diff --git a/include/parse_config.ml b/include/parse_config.ml index 229f9c52..bd407e31 100644 --- a/include/parse_config.ml +++ b/include/parse_config.ml @@ -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