make config file and port optional

This commit is contained in:
rpena 2026-03-08 17:45:32 +01:00
parent b06a92c7de
commit 06edf3dd6b

View file

@ -32,7 +32,9 @@ struct
let config = let config =
let filename = Fpath.(Project.config_dir / "config.scfg") in let filename = Fpath.(Project.config_dir / "config.scfg") in
match Scfg.Parse.from_file filename with match Scfg.Parse.from_file filename with
| Error (`Msg msg) -> Fmt.failwith "%s" msg | Error (`Msg _msg) ->
(* TODO: warn to say there is no config file! *)
[]
| Ok config -> config | Ok config -> config
open Scfg.Query open Scfg.Query
@ -40,7 +42,9 @@ struct
let port = let port =
let directive = get_dir "port" config in let directive = get_dir "port" config in
match directive with match directive with
| None -> Fmt.failwith "configuration file is missing a port directive" | None ->
(* TODO: warn to say we use a default port! *)
8080
| Some directive -> ( | Some directive -> (
let param = get_param_int 0 directive in let param = get_param_int 0 directive in
match param with match param with