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

Override config item in artisan kernel #27711

Closed
sinnbeck opened this issue Feb 28, 2019 · 6 comments
Closed

Override config item in artisan kernel #27711

sinnbeck opened this issue Feb 28, 2019 · 6 comments

Comments

@sinnbeck
Copy link

  • Laravel Version: 5.7.28
  • PHP Version: 7.2
  • Database Driver & Version:

Description:

In 5.7.22 it was possible to override config items by overriding the bootstap method

public function bootstrap()
    {
        parent::bootstrap();
        if (App::environment('local')) {
            app('config')->set(['database.connections.mysql.host' => '127.0.0.1']);
        }
    }

This worked and used the new host when running database tasks
After upgrading to 5.7.28 this is no longer possible

Steps To Reproduce:

Install 5.7.22 and check that it is possible to override database host.
Install 5.7.28 and see that it no longer works.

@driesvints
Copy link
Member

Can you pinpoint the exact version which broke this? That might give a hint what's causing this.

@sinnbeck
Copy link
Author

Works in 5.7.24 and breaks in 5.7.25

@driesvints
Copy link
Member

I can't really see what might have caused this honestly: v5.7.24...v5.7.25

@sinnbeck
Copy link
Author

It seems to be this
src/Illuminate/Database/DetectsLostConnections.php
Here you removed
'php_network_getaddresses: getaddrinfo failed: Name or service not known',

It seems that it first builds the connector (which generates an error), then bootstraps artisan (overriding the config) and then getting the connector again (now with the new config)

It would seem that I need to find a better way of overriding the config :( Any suggestions would be great!

@sinnbeck
Copy link
Author

Alas. There seems to be no viable method of doing this currently :(
Fingers crossed for either a config file for artisan or even better a service provider, someday.

@driesvints
Copy link
Member

Seems like it was reverted for being to generic: #27418

I indeed fear there's not a viable way to do this atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants