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

[5.8] SERVER_PORT env in ServeCommand #28849

Merged
merged 1 commit into from Jun 15, 2019

Conversation

Projects
None yet
4 participants
@anthonybudd
Copy link
Contributor

commented Jun 14, 2019

I work at a relatively large corporate firm and we heavily use Laravel/Lumen to make microservices. I often run 4 or 5 of these projects simultaneously using the command php artisan serve. It would be really handy if I could specify a default port for each of the projects by adding a new environment variable into the .env.

In this pull request I've made a very small change by adding the env() function to the ServeCommand so if the environment variable SERVER_PORT is set it will use that port otherwise it will default to the standard port 8000 if this is not set.

@mfn

This comment has been minimized.

Copy link
Contributor

commented Jun 14, 2019

env() is not allowed outside config/*

Although one could argue the ServeCommand is not for production so it doens't matter (config should not be cached for development).

@anthonybudd

This comment has been minimized.

Copy link
Contributor Author

commented Jun 14, 2019

env() is not allowed outside config/*

This is a justifiable exception. Using the --port flag isn't practical when you are running 10-15 different projects that need to have a defined port and have that info shared across an international team of 20 devs.

This is a simple and effective solution to a real world problem.

@ManojKiranA

This comment has been minimized.

Copy link

commented Jun 15, 2019

i think @driesvints will suggest you to send this to master branch

And This is my suggestion if you add default host in the Command it will be help full

So Here is the Situation Since Some Project or in Development but my team are using it via connection to local ip to do that here is what i do

10.10.250.22 is my local ip address

php artisan serve --port 9000 --host 10.10.250.22

So it Will be nice if you add host variable too

Anyway lets see what @taylorotwell Says

@taylorotwell taylorotwell merged commit a1c039c into laravel:5.8 Jun 15, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@GrahamCampbell GrahamCampbell changed the title SERVER_PORT env in ServeCommand [5.8] SERVER_PORT env in ServeCommand Jun 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.