diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2025-03-13 20:17:51 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2025-04-08 18:39:49 +0200 |
commit | 9e2dbe43abe97c4e60b158e5fa52172468a2afb8 (patch) | |
tree | f58276e500d8ab0b84cdf74cc36fc73d4bca3892 /lib/configuration/importConf.ml | |
parent | 0bdc640331b903532fb345930e7078752ba54a2d (diff) |
Declare the files to load from an external configuration file
Diffstat (limited to 'lib/configuration/importConf.ml')
-rw-r--r-- | lib/configuration/importConf.ml | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/configuration/importConf.ml b/lib/configuration/importConf.ml index 2df24bd..4b49686 100644 --- a/lib/configuration/importConf.ml +++ b/lib/configuration/importConf.ml @@ -1,14 +1,22 @@ module TomlReader = Read_conf.Make (Helpers.Toml.Decode) -let t_of_toml : Otoml.t -> (ImporterSyntax.t, string) result = - fun toml -> +type loader_context = TomlReader.loader_context = { + checkFile : string -> bool; + loadFile : string -> Otoml.t; +} + +let t_of_toml : + context:loader_context -> Otoml.t -> (ImporterSyntax.t, string) result = + fun ~context toml -> let version = Otoml.find_or ~default:ImporterSyntax.latest_version toml (Otoml.get_integer ~strict:false) [ "version" ] in match version with - | n when n = ImporterSyntax.latest_version -> TomlReader.read toml + | n when n = ImporterSyntax.latest_version -> begin + TomlReader.read context toml + end | _ -> Printf.eprintf "Unsuported version : %d\n" version; exit 1 |