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

[8.x] Use first host if multiple #40226

Merged
merged 2 commits into from
Jan 2, 2022

Conversation

jelib3an
Copy link
Contributor

@jelib3an jelib3an commented Jan 2, 2022

According to the docs, the host option can be an array of hosts.

If the php artisan db is called with either --read or --write, this adds a check to use the first host from the array.

This is a limited use case so impact should be low. I don't know how to write tests for this but if it is necessary and someone can kindly show me how, I'd be happy to add tests.


Fixes #40186.

@NickSdot
Copy link
Contributor

NickSdot commented Jan 2, 2022

@jelib3an don't you think it would be better to allow "--read" to optionally accept a value (array key) instead of doing this fully hard coded?

@GrahamCampbell GrahamCampbell changed the title fixes #40186 : use first host if multiple [8.x] Use first host if multiple Jan 2, 2022
@taylorotwell taylorotwell merged commit dd6ac5f into laravel:8.x Jan 2, 2022
@jelib3an jelib3an deleted the handle-host-configured-as-array branch January 2, 2022 22:28
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.

php artisan db command does not work when separate read and write hosts are configures in db config
3 participants