summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/startup.ml32
-rw-r--r--src/startup.mli2
2 files changed, 2 insertions, 32 deletions
diff --git a/src/startup.ml b/src/startup.ml
index 76599b0..20882cb 100644
--- a/src/startup.ml
+++ b/src/startup.ml
@@ -78,44 +78,16 @@ let create_server accept_connection sock =
Lwt_unix.accept sock >>= accept_connection >>= serve
in serve
-(* strip commponent version string *)
-let strip_version s =
- let rex = Pcre.regexp ~flags:[`MULTILINE;`DOTALL] "(^//.*)" in
- let res = Pcre.split ~max:0 ~rex s in
- match res with
- | h :: _ -> h
- | [] -> panic "Failure applying regex to config string"
-
-(** Load the appliance configuration file *)
-let load_config file =
- try
- let chan = open_in file in
- let s = really_input_string chan (in_channel_length chan) in
- let config = strip_version s |> Vyos1x.Parser.from_string in
- Ok config
- with
- | Sys_error msg -> Error msg
- | Vyos1x.Util.Syntax_error (opt, msg) ->
- begin
- match opt with
- | None ->
- let out = Printf.sprintf "Parse error: %s\n" msg
- in Error out
- | Some (line, pos) ->
- let out = Printf.sprintf "Parse error: %s line %d pos %d\n" msg line pos
- in Error out
- end
-
(** Load the appliance configuration file or the fallback config *)
let load_config_failsafe main fallback =
- let res = load_config main in
+ let res = Vyos1x.Config_file.load_config main in
match res with
| Ok config -> config
| Error msg ->
Lwt_log.error
(Printf.sprintf "Failed to load config file %s: %s. Attempting to load fallback config %s" main msg fallback) |>
Lwt.ignore_result;
- let res = load_config fallback in
+ let res = Vyos1x.Config_file.load_config fallback in
begin
match res with
| Ok config -> config
diff --git a/src/startup.mli b/src/startup.mli
index dc84736..1415953 100644
--- a/src/startup.mli
+++ b/src/startup.mli
@@ -14,8 +14,6 @@ val create_server :
(Lwt_unix.file_descr * Lwt_unix.sockaddr -> unit Lwt.t) ->
Lwt_unix.file_descr -> unit -> 'a Lwt.t
-val load_config : string -> (Vyos1x.Config_tree.t, string) result
-
val load_config_failsafe : string -> string -> Vyos1x.Config_tree.t
val load_interface_definitions : string -> (Vyos1x.Reference_tree.t, string) result