From ec31459b86ee4032116e99e81a32e4d665b7e664 Mon Sep 17 00:00:00 2001 From: swrup Date: Thu, 26 Feb 2026 17:24:47 +0100 Subject: [PATCH] --- src/parse_config.ml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/parse_config.ml b/src/parse_config.ml index 5e191bd8..044873fb 100644 --- a/src/parse_config.ml +++ b/src/parse_config.ml @@ -178,7 +178,22 @@ let yes_no = function | s -> fail "expected `YES`/`NO` value, got `%s`" s let uri s = Uri.of_string s -let amount s = s |> Amount.of_string |> unwrap + +let amount = + let currency = ref None in + fun s -> + let amount = s |> Amount.of_string |> unwrap in + match !currency with + | None -> + currency := Some amount.currency; + amount + | Some cur -> ( + match String.equal amount.currency cur with + | false -> + fail "only one kind of currency is supported, found: `%s` and `%s`." + amount.currency cur + | true -> amount) + let duration s = Config_duration.(s |> parse |> to_time_span) let ed25519 s =