make config file and port optional
This commit is contained in:
parent
b06a92c7de
commit
06edf3dd6b
1 changed files with 6 additions and 2 deletions
|
|
@ -32,7 +32,9 @@ struct
|
|||
let config =
|
||||
let filename = Fpath.(Project.config_dir / "config.scfg") in
|
||||
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
|
||||
|
||||
open Scfg.Query
|
||||
|
|
@ -40,7 +42,9 @@ struct
|
|||
let port =
|
||||
let directive = get_dir "port" config in
|
||||
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 -> (
|
||||
let param = get_param_int 0 directive in
|
||||
match param with
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue