laravel / sail

Docker files for running a basic Laravel application.
https://laravel.com/docs/sail
MIT License
1.65k stars 473 forks source link

[1.x] Fix Add Service as Dependencies of App Service #650

Closed newarifrh closed 8 months ago

newarifrh commented 8 months ago

Problem

Currently the app service has the default name "laravel.test". When we change the service application according to what we want, several issues will arise. An example of this is when adding additional services as dependencies.

sail artisan sail:add mailpit

then it will issue a warning:

Couldn't find the laravel.test service. Make sure you add mailpit to the depends_on config.

Even though we have given the app service name to the environment as follows:

APP_SERVICE=your_app

in the sail file it says APP_SERVICE taken from APP_SERVICE in the environment or laravel.test as the default name.

export APP_SERVICE=${APP_SERVICE:-"laravel.test"}

Solution

To resolve this issue and prevent warnings during service additions, this pull request introduces a check for the APP_SERVICE environment variable. If APP_SERVICE is absent, the system defaults to 'laravel.test' as the service name. This adjustment ensures smooth dependency addition without unnecessary warnings.

This update aims to enhance the reliability and usability of the Sail environment.

taylorotwell commented 8 months ago

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!

If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.