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

[9.x] Set custom host to the serve command with environment variable #41831

Merged
merged 1 commit into from
Apr 5, 2022

Conversation

medabkari
Copy link
Contributor

This PR proposes the ability to set a custom host option for the php artisan serve command through a SERVER_HOST environment variable similar to the SERVER_PORT variable for ports.

This is useful for developers working locally with hostnames such as example.test to avoid setting the --host option on each php artisan serve execution.

@GrahamCampbell GrahamCampbell changed the title Set custom host to the serve command with environment variable [9.x] Set custom host to the serve command with environment variable Apr 5, 2022
@taylorotwell taylorotwell merged commit abd3506 into laravel:9.x Apr 5, 2022
@medabkari medabkari deleted the feat-custom-host branch April 6, 2022 05:55
@@ -211,7 +211,7 @@ protected function canTryAnotherPort()
protected function getOptions()
{
return [
['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'],
['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', Env::get('SERVER_HOST', '127.0.0.1')],
['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', Env::get('SERVER_PORT')],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the port default to sth aswell?

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.

None yet

3 participants