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

fix: do not try to send notifications when they are disabled #231

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

kolaente
Copy link
Contributor

@kolaente kolaente commented Jul 3, 2024

Currently, the command will be triggered from the /health endpoint and will send a notification no matter what is configured. This PR adds a check so that it will only do that when notifications are actually enabled.

In an application I'm building, we don't have mails configured. Because of that, sending the notification fails later on and spams the log with failed attempts, making tracking actual errors way harder.

Currently, the command will be triggered from the /health endpoint and will send a notification no matter what is configured. This PR adds a check so that it will only do that when notifications are actually enabled.
@@ -29,7 +29,7 @@ public function handle(): int

$results = $this->runChecks();

if (! $this->option('no-notification')) {
if (! $this->option('no-notification') && config('health.notifications.enabled', false)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the right place for this, but it fixes the problem for me.

@kolaente
Copy link
Contributor Author

kolaente commented Jul 4, 2024

The test failure seems to be related to a change in space for a function, do the fixtures need adjustement?

@freekmurze
Copy link
Member

Could you rebase against main to fix the tests?

@kolaente
Copy link
Contributor Author

Done

@freekmurze freekmurze merged commit 1359fde into spatie:main Jul 15, 2024
11 checks passed
@freekmurze
Copy link
Member

Thanks!

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.

2 participants