Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

level-a
Copy link
Contributor

@level-a level-a commented Oct 2, 2020

setup http_server with http_config binded to systemd socket (by default) or to provided addr (host:port)

httpev.ml Outdated
match addr, Systemd.Daemon.listen_fds_lwt () with
| None, [] ->
log#error "bind not provided and no systemd socket available";
exit 1
Copy link
Contributor

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 =
Copy link
Contributor

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.

Copy link
Contributor

@Khady Khady left a 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.

@Khady
Copy link
Contributor

Khady commented Nov 4, 2020

can this be merged?

setup http_server with http_config binded to systemd socket (by default)
or to provided addr (host:port)
Copy link
Contributor

@Khady Khady left a 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 =
Copy link

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

@ygrek ygrek self-assigned this Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants