diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-01-26 10:51:49 +0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-01-26 10:51:49 +0700 |
commit | 8938e627c04c01f8f30a854be6903a9abcd2fa5b (patch) | |
tree | 370b596d917f62dde6b01c3eed49872d57f1894b /src | |
parent | 1df4b0b50993985af84236c4508eeec5ec739a48 (diff) | |
download | vyconf-8938e627c04c01f8f30a854be6903a9abcd2fa5b.tar.gz vyconf-8938e627c04c01f8f30a854be6903a9abcd2fa5b.zip |
Fix build with new Toml module version.
I have no idea where TomlLenses module is gone but frankly the whole thing
is a lot less pretty without it.
Diffstat (limited to 'src')
-rw-r--r-- | src/vyconf_config.ml | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vyconf_config.ml b/src/vyconf_config.ml index 7a87c1a..b7d1352 100644 --- a/src/vyconf_config.ml +++ b/src/vyconf_config.ml @@ -34,10 +34,9 @@ let empty_config = { (* XXX: We assume that nesting in TOML config files never goes beyond two levels *) let get_field conf tbl_name field_name = - (* NB: TomlLenses module uses "table" and "field" names for function names, - hence tbl_name and field_name - *) - TomlLenses.(get conf (key tbl_name |-- table |-- key field_name |-- string)) + try + Some (Toml.get_string (Toml.key field_name) (Toml.get_table (Toml.key tbl_name) conf)) + with Not_found -> None let mandatory_field conf table field = let value = get_field conf table field in @@ -52,7 +51,7 @@ let optional_field default conf table field = let load filename = try let open Defaults in - let conf_toml = Toml.Parser.from_filename filename |> Toml.Parser.unsafe in + let conf_toml = Toml.Parser.from_filename filename in let conf = empty_config in (* Mandatory fields *) let conf = {conf with app_name = mandatory_field conf_toml "appliance" "name"} in |