Refactor webserver port to a variable

This commit is contained in:
Stavros Polymenis 2017-11-02 22:37:14 +00:00
parent 82a493bd82
commit 712325aa7b

View File

@ -133,11 +133,12 @@ let serve config_filename =
>>= html_response
in
let port = match Uri.port web_config.Configuration.url with Some p -> p | None -> 3666 in
print_endline @@ "Server address: " ^ Uri.to_string web_config.Configuration.url;
print_endline @@ "Press Ctrl+C to stop.";
let app =
App.empty
|> App.port (match Uri.port web_config.Configuration.url with Some p -> p | None -> 3666)
|> App.port port
|> middleware @@
Middleware.static
~local_path:(Fpath.to_string web_config.Configuration.static)