Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

select available port #169

Closed
Rich-Harris opened this issue Mar 5, 2018 · 3 comments
Closed

select available port #169

Rich-Harris opened this issue Mar 5, 2018 · 3 comments

Comments

@Rich-Harris
Copy link
Member

It would make sense if Sapper automatically selected an available port (starting at 3000, since that's what we're currently using) when doing sapper dev or sapper start.

I have a situation though where I have multiple Sapper apps that need to communicate with each other, so the ports need to be known ahead of time. For that reason it would also make sense if we could select a port with sapper dev --port 4567 (or -p 4567), and Sapper would bail if it wasn't available.

@Rich-Harris Rich-Harris mentioned this issue Mar 5, 2018
Rich-Harris added a commit that referenced this issue Mar 5, 2018
@thgh
Copy link
Contributor

thgh commented Mar 5, 2018

I'm running multiple sapper instances with "dev": "PORT=4000 sapper dev". It works properly 👍

Should those occurences of 3000 be replaced by process.env.PORT || 3000 ? Or is that not needed?

@Rich-Harris
Copy link
Member Author

ah yeah, there's a couple of places where things are hardcoded that shouldn't be. Good catch. And yeah, I guess we may as well treat PORT=4000 sapper dev as equivalent to sapper dev -p 4000. Reopening this

@Rich-Harris Rich-Harris reopened this Mar 5, 2018
Rich-Harris added a commit that referenced this issue Mar 10, 2018
@Rich-Harris
Copy link
Member Author

Fixed by #184

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

No branches or pull requests

2 participants