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

feat: add host option #4

Merged
merged 2 commits into from
Apr 12, 2021
Merged

feat: add host option #4

merged 2 commits into from
Apr 12, 2021

Conversation

mrazauskas
Copy link
Contributor

@mrazauskas mrazauskas commented Apr 10, 2021

At the moment getPort() always checks ports on 0.0.0.0.

Issue: if some app already listens on localhost:3000 (rather usual in dev environment), getPort(3000) will return 3000. It simply checked if 0.0.0.0:3000 is free. (Would be good to check, but it sounds similar to issue #3.)

Solution: we need a possibility to check host and port combination. In similar situation like above getPort({ host: 'localhost' }) would return 4000.

What should be the default value of the host option? Perhaps the same, which is used by listhen?

@mrazauskas mrazauskas marked this pull request as draft April 11, 2021 08:33
@mrazauskas mrazauskas marked this pull request as ready for review April 11, 2021 12:31
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pi0
Copy link
Member

pi0 commented Apr 12, 2021

What should be the default value of the host option? Perhaps the same, which is used by listhen?

I think we might ideally support host as array to check both 127.0.0.1 (internal) and 0.0.0.0 (external)

@pi0 pi0 merged commit f85d941 into unjs:master Apr 12, 2021
@mrazauskas
Copy link
Contributor Author

Hosts array as default value. That’s really smart! I will try it out.

@mrazauskas mrazauskas deleted the feat-host-option branch April 12, 2021 10:36
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.

None yet

2 participants