blob: fb1fc88e96bfc47751ea20759d6b35352647280a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
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";
}
|