Commit 009f66a1 authored by Vlad Dumitru's avatar Vlad Dumitru
Browse files

add commandline parameters to server

parent 964b2417
......@@ -410,13 +410,14 @@ let diff_tiers db request =
Dream.respond (Speechcake.Annotation.Textgrid.Write.to_string tiers)
| Error e ->
Dream.respond ~status:`Bad_Request (string_of_error e)
let () =
let run_server interface port () =
let open Dream in
initialize_log ~level:`Debug () ;
let db = init () in
run
run ~interface ~port
@@ logger
@@ cors
@@ router
......@@ -458,3 +459,21 @@ let () =
; post "/checkout" (get_checkout db)
]
@@ not_found
let cmd =
let open Cmdliner in
let open Term in
let doc = "start a Konditorei server" in
let interface =
let doc = "Interface to listen on" in
Arg.(value & opt string "localhost" & info [ "i"; "interface" ] ~doc) in
let port =
let doc = "Port to listen on" in
Arg.(value & opt int 8080 & info [ "p"; "port" ] ~doc) in
( const run_server $ interface $ port
, Term.info "konditorei" ~doc
)
let () =
let open Cmdliner in
Term.exit @@ Term.eval cmd
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment