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

Array of preferred ports instead of just one number #19

Closed
AxelTerizaki opened this issue Mar 29, 2018 · 3 comments · Fixed by #21
Closed

Array of preferred ports instead of just one number #19

AxelTerizaki opened this issue Mar 29, 2018 · 3 comments · Fixed by #21

Comments

@AxelTerizaki
Copy link

I think it could be interesting to have the ability to pass an array of preferred ports instead of just one before get-port gives up and tries a random port.

Would this be possible?

@kevva
Copy link

kevva commented Mar 29, 2018

I have the same question as in #6 (comment).

What's the point on having a preferred port if it's not guaranteed? I'm interested in your use-case.

Sure, having one preferred port is reasonable, but having an array seems pretty random?

@AxelTerizaki
Copy link
Author

My app is trying to be as user-friendly as possible, so I'm trying to see if port 80 is available to start a webserver on it. It might be available, but some OSes don't allow non-admin users to open ports below 1000. So if 80 isn't open, I'd like to try to see if another port I'd like to use (1337) is available and use it. If all else fails, get a random port.

I could always try to call get-port twice, once with port 80 and once with port 1337, too, I guess.

If you consider this is too much hassle, I'll do it my way. Was just an idea of something to add :)

@sindresorhus
Copy link
Owner

PR welcome. Should come with tests and docs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants