Skip to content

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

Merged
taylorotwell merged 1 commit intolaravel:9.xfrom
medabkari:feat-custom-host
Apr 5, 2022
Merged

[9.x] Set custom host to the serve command with environment variable#41831
taylorotwell merged 1 commit intolaravel:9.xfrom
medabkari:feat-custom-host

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
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.

3 participants