use logs + add static.ml + fmt
This commit is contained in:
parent
ad648178ab
commit
cf4da6b382
15 changed files with 246 additions and 196 deletions
|
|
@ -3,10 +3,9 @@ open Parse_config
|
|||
let config_data =
|
||||
let path = Fpath.to_string (Fpath.v "default.config") in
|
||||
match Assets_crunch.read path with
|
||||
| None -> Fmt.failwith "static file not found: `%s`" path
|
||||
| None -> fail "static file not found: `%s`" path
|
||||
| Some data ->
|
||||
let v = Parse_data.parse data in
|
||||
(*Fmt.epr "config file:@\n%a@." Pp_debug.pp_config v;*)
|
||||
v
|
||||
|
||||
module Exchange = struct
|
||||
|
|
@ -117,14 +116,11 @@ module Currency = struct
|
|||
List.find_opt (fun v -> v.code = Exchange.currency) all_currencies
|
||||
with
|
||||
| None ->
|
||||
fail_with
|
||||
(Fmt.str
|
||||
"section `[currency-%s]` not found, currency `%s` is not defined"
|
||||
Exchange.currency Exchange.currency)
|
||||
fail "section `[currency-%s]` not found, currency `%s` is not defined"
|
||||
Exchange.currency Exchange.currency
|
||||
| Some v -> (
|
||||
match v.enabled = `YES with
|
||||
| false ->
|
||||
fail_with (Fmt.str "currency `%s` is not enabled" Exchange.currency)
|
||||
| false -> fail "currency `%s` is not enabled" Exchange.currency
|
||||
| true -> v)
|
||||
end
|
||||
|
||||
|
|
@ -171,7 +167,7 @@ module Coin = struct
|
|||
age_restricted=
|
||||
( get "age_restricted" |> yes_no |> function
|
||||
| `NO -> `NO
|
||||
| `YES -> fail_with "`age_restricted = YES` is not supported" );
|
||||
| `YES -> fail "`age_restricted = YES` is not supported" );
|
||||
}
|
||||
|
||||
let all_coins = List.map parse_coin coin_sections
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue