Browse Source

Builder_web_app: Fixed type-error + some 80-column fixes

pull/105/head
rand00 4 months ago
parent
commit
6a1c8b0ecd
  1. 20
      bin/builder_web_app.ml

20
bin/builder_web_app.ml

@ -81,18 +81,32 @@ let init_influx name data =
let setup_app level influx port host datadir cachedir configdir =
let dbpath = Printf.sprintf "%s/builder.sqlite3" datadir in
let datadir = Fpath.v datadir in
let cachedir = Option.fold ~none:Fpath.(datadir / "_cache") ~some:Fpath.v in
let cachedir =
cachedir |> Option.fold ~none:Fpath.(datadir / "_cache") ~some:Fpath.v
in
let configdir = Fpath.v configdir in
let () = init_influx "builder-web" influx in
match Builder_web.init dbpath datadir with
| Error (#Caqti_error.load as e) ->
Format.eprintf "Error: %a\n%!" Caqti_error.pp e;
exit 2
| Error (#Caqti_error.connect | #Caqti_error.call_or_retrieve | `Msg _ | `Wrong_version _ as e) ->
| Error (
#Caqti_error.connect
| #Caqti_error.call_or_retrieve
| `Msg _
| `Wrong_version _ as e
) ->
Format.eprintf "Error: %a\n%!" Builder_web.pp_error e;
exit 1
| Ok () ->
let level = match level with None -> None | Some Logs.Debug -> Some `Debug | Some Info -> Some `Info | Some Warning -> Some `Warning | Some Error -> Some `Error | Some App -> None in
let level = match level with
| None -> None
| Some Logs.Debug -> Some `Debug
| Some Info -> Some `Info
| Some Warning -> Some `Warning
| Some Error -> Some `Error
| Some App -> None
in
Dream.initialize_log ?level ();
Dream.run ~port ~interface:host ~https:false
@@ Dream.logger

Loading…
Cancel
Save