diff options
author | John Estabrook <jestabro@vyos.io> | 2024-10-23 18:50:46 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2024-10-27 20:50:41 -0500 |
commit | 5d7927e392e70436aaca1f8261e5d4ab8e4ec8f8 (patch) | |
tree | d824589851f788ab4864c31b44ec6cbab2f5cefe /src/startup.ml | |
parent | dd9271b4304c6b1a5a2576821d1b2b8fd3aa6bf5 (diff) | |
download | vyconf-5d7927e392e70436aaca1f8261e5d4ab8e4ec8f8.tar.gz vyconf-5d7927e392e70436aaca1f8261e5d4ab8e4ec8f8.zip |
T6718: update build system, drop batteries, and adjust for lib changes
Update as needed for use with contemporary vyos1x-config:
. update build system to use dune
. drop use of batteries
. update for protoc breaking changes in versions >= 3.0
. remove files now in vyos1x-config (config_tree et. al.; parsing)
Diffstat (limited to 'src/startup.ml')
-rw-r--r-- | src/startup.ml | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/startup.ml b/src/startup.ml index cea5f02..4cf109c 100644 --- a/src/startup.ml +++ b/src/startup.ml @@ -75,11 +75,21 @@ let create_server accept_connection sock = let load_config file = try let chan = open_in file in - let config = Curly_parser.config Curly_lexer.token (Lexing.from_channel chan) in + let s = really_input_string chan (in_channel_length chan) in + let config = Vyos1x.Parser.from_string s in Ok config with | Sys_error msg -> Error msg - | Curly_parser.Error -> Error "Parse error" + | 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 = @@ -99,7 +109,7 @@ let load_config_failsafe main fallback = (* Load interface definitions from a directory into a reference tree *) let load_interface_definitions dir = - let open Reference_tree in + let open Vyos1x.Reference_tree in let relative_paths = FileUtil.ls dir in let absolute_paths = try Ok (List.map Util.absolute_path relative_paths) |