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

Should the script use PORT from env? #5

Open
ArthurTimofey opened this issue Sep 28, 2023 · 3 comments
Open

Should the script use PORT from env? #5

ArthurTimofey opened this issue Sep 28, 2023 · 3 comments

Comments

@ArthurTimofey
Copy link

Hello,

Love the package and seems to work very well indeed. I was running into an issue at the beginning since I have my port stored in ENV file, the WS defaults to port 3000 so maybe a suggestion is to check for ENV port as well?

Thanks

@aabccd021
Copy link
Owner

Actually last week I made it derive port from running server, but I forgot to publish it on npm, and I published it just now.

I'm not sure wether this solves your problem (does running server already use PORT env?).

Can you verify on the newest v0.1.2?

@ArthurTimofey
Copy link
Author

Im sorry, I should have clarified,

By default bun uses PORT env variable to run the server, so you do not need to pass it to the config for your server in order to start the server, the live reload only checks the config for the server and so if you do not pass it it will default to 3000, hence my confusion as to why it did not work the first time I launched my app :), it works fine if I still pass in the port env variable into config of the server itself.

@aabccd021
Copy link
Owner

No worries. Though I still don't get the problem.

Here is how it currently works on my machine on v0.1.2. Is this related to your problem?

> bun --version
1.0.3

> bun install bun-html-live-reload
bun add v1.0.3 (25e69c71)

 installed [email protected]


 1 packages installed [1294.00ms]

> bun --hot example.ts
Started server http://localhost:3000

> PORT=4000 bun --hot example.ts
Started server http://localhost:4000

> echo "PORT=5000" > .env

> bun --hot example.ts
Started server http://localhost:5000

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

No branches or pull requests

2 participants