From 9473b2c009961d2e66a31673c38831b59528b706 Mon Sep 17 00:00:00 2001
From: Sébastien Dailly <sebastien@dailly.me>
Date: Wed, 8 Jan 2025 13:14:13 +0100
Subject: The version in the document is not mandatory anymore

---
 lib/configuration/importConf.ml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'lib/configuration')

diff --git a/lib/configuration/importConf.ml b/lib/configuration/importConf.ml
index eb7c8d2..3406a11 100644
--- a/lib/configuration/importConf.ml
+++ b/lib/configuration/importConf.ml
@@ -31,11 +31,15 @@ module TomlReader = Read_conf.Make (Helpers.Toml.Decode)
 
 let t_of_toml : Otoml.t -> (Syntax.t, string) result =
  fun toml ->
+  let latest_version = 1 in
+
   let version =
-    Otoml.find toml (Otoml.get_integer ~strict:false) [ "version" ]
+    Otoml.find_or ~default:latest_version toml
+      (Otoml.get_integer ~strict:false)
+      [ "version" ]
   in
   match version with
-  | 1 -> TomlReader.read toml
+  | n when n = latest_version -> TomlReader.read toml
   | _ ->
       Printf.eprintf "Unsuported version : %d\n" version;
       exit 1
-- 
cgit v1.2.3