opcodesio / log-viewer

Fast and beautiful Log Viewer for Laravel
https://log-viewer.opcodes.io
MIT License
3.39k stars 237 forks source link

API only config #355

Closed hungthai1401 closed 2 months ago

hungthai1401 commented 3 months ago

This PR introduces the api only config to avoid registering viewer route. Sometimes, I don't want to use the viewer so I had set its default value is false. Usage: Add LOG_VIEWER_API_ONLY=true to .env

arukompas commented 2 months ago

hey @hungthai1401

I appreciate the help, but the latest change made it even more complex than before :)

You were on the right track initially, just missing a way to "unload" previously-set routes so they can be registered again.

Here's my attempt at this - https://github.com/opcodesio/log-viewer/pull/358, which includes the exact same tests and logic you did in the beginning, but with updated reloadRoutes helper method.

I'm happy for you to submit the same changes to get the contribution status, if you wish. Let me know what you think!

hungthai1401 commented 2 months ago

@arukompas You saved my life. Your solution is so simple but smart. I will apply when your PR is merged. Thank you so much

arukompas commented 2 months ago

hey @hungthai1401 , tagged a new release, v3.8.0 which now contains this config option.

Closing this PR as no longer needed.

Thanks for idea and your work! 🙌