let config_file = "default_config.toml" type t = { repositories_root : string; user : string; default_branch : string; max_commits_displayed : int; } let config = match Toml.Parser.from_filename config_file with | `Error (e, _) -> failwith ("Config parse error: " ^ e) | `Ok table -> let find key = Toml.Types.Table.find (Toml.Min.key key) table in let find_string key = match find key with TString s -> s | _ -> raise Not_found in let find_int key = match find key with TInt i -> i | _ -> raise Not_found in { repositories_root = find_string "repositories_root"; user = find_string "user"; default_branch = find_string "default_branch"; max_commits_displayed = find_int "max_commits_displayed"; }