Skip to content

[5.8] SERVER_PORT env in ServeCommand#28849

Merged
taylorotwell merged 1 commit intolaravel:5.8from
anthonybudd:5.8
Jun 15, 2019
Merged

[5.8] SERVER_PORT env in ServeCommand#28849
taylorotwell merged 1 commit intolaravel:5.8from
anthonybudd:5.8

Conversation

@anthonybudd
Copy link
Contributor

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
Copy link
Contributor

mfn 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
Copy link
Contributor Author

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
Copy link
Contributor

ManojKiranA 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
@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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants