-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
httpev: add http_bind function #6
base: master
Are you sure you want to change the base?
Conversation
httpev.ml
Outdated
match addr, Systemd.Daemon.listen_fds_lwt () with | ||
| None, [] -> | ||
log#error "bind not provided and no systemd socket available"; | ||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't use exit here, one might want to recover from the error or try again
httpev.ml
Outdated
@@ -1119,6 +1119,21 @@ let setup_lwt config answer = | |||
let server_lwt config answer = | |||
Lwt_main.run @@ setup_lwt config answer | |||
|
|||
let http_bind addr http_config = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function should be named setup_<something>
because it's what it does. E.g. setup_bind_lwt
.
be187d3
to
0fd77bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok. I am not sure if it's useful or not to return the signature. But I leave that to you.
can this be merged? |
setup http_server with http_config binded to systemd socket (by default) or to provided addr (host:port)
0fd77bb
to
4703287
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. I wonder if there should be a verbose
argument and log only when it is true
@@ -1119,6 +1123,24 @@ let setup_lwt config answer = | |||
let server_lwt config answer = | |||
Lwt_main.run @@ setup_lwt config answer | |||
|
|||
let setup_bind_lwt addr config answer = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is config.connection
which this api totally ignores which is not cool. Instead we should break api and make config.connection a variant itself and make all setup_* functions honor that variant and provide convenience functions to set that variant
setup http_server with http_config binded to systemd socket (by default) or to provided addr (host:port)