From edc0601bf2b179a6b82848af9effc2e2cae9bf47 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 24 Sep 2015 17:55:32 +0600 Subject: Add minimal vyconfd config loader. --- src/vyconf_config.ml | 14 ++++++++++++++ src/vyconf_config.mli | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/vyconf_config.ml create mode 100644 src/vyconf_config.mli diff --git a/src/vyconf_config.ml b/src/vyconf_config.ml new file mode 100644 index 0000000..60ac2c9 --- /dev/null +++ b/src/vyconf_config.ml @@ -0,0 +1,14 @@ +type vyconf_config = { + app_name: string; + app_dir: string; + config_dir: string; + primary_config: string; + fallback_config: string; + socket: string; +} [@@deriving yojson] + + +let load filename = + try Yojson.Safe.from_file filename |> vyconf_config_of_yojson + with Sys_error msg -> `Error msg + diff --git a/src/vyconf_config.mli b/src/vyconf_config.mli new file mode 100644 index 0000000..52060af --- /dev/null +++ b/src/vyconf_config.mli @@ -0,0 +1,10 @@ +type vyconf_config = { + app_name: string; + app_dir: string; + config_dir: string; + primary_config: string; + fallback_config: string; + socket: string; +} + +val load : string -> [ `Error of bytes | `Ok of vyconf_config ] -- cgit v1.2.3