TrustedProxy
TrustedProxy copied to clipboard
Merge config file in the service registration
In this PR, I simply renamed the boot
to register
, and deleted boot
as it is unused for now.
mergeConfigFrom
should be called in the register
method, it means once the package being registered, its config are ready to use. Then other services can access them safely without caring about the order of application services bootstrap.
This is also mentioned in the official documentation:
To merge the configurations, use the mergeConfigFrom method within your service provider's register method.
publishes
is useful only in the console application, and in the console application all services will be booted, so it does not matter putting publishes
whether in register
or boot
method. Some core services also put it in register
to make code organized, such as MailServiceProvider::registerMarkdownRenderer
.
I'll test it out but sounds good, appreciate it!
Doesn't merged yet? I think this should be merged.
😅
Have a new born at home, things will be slow to change :D
If you can help test this on various versions of Laravel, that'd be great. This package is still meant to be backwards compatible for all Laravel 5.* if possible.
@fideloper 😀 Congrats 🎉
Thanks! On Mon, Dec 4, 2017 at 11:15 Elf Sundae [email protected] wrote:
@fideloper https://github.com/fideloper 😀 Congrats 🎉
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/fideloper/TrustedProxy/pull/90#issuecomment-349032929, or mute the thread https://github.com/notifications/unsubscribe-auth/AAch0zErHKvwJG9m6nV5-8IqKzT1rcPAks5s9CiogaJpZM4P4iNE .
:-1: I'd dispute the recommendations in the docs actually. Makes much more sense to apply the config fallbacks during boot, since register shouldn't assume the config system is ready yet.
eg https://github.com/GrahamCampbell/Laravel-GitHub/blob/master/src/GitHubServiceProvider.php