mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-28 02:06:37 -04:00
fix(notifications): implement toWebhook() for always-send notifications
WebhookChannel::send() calls toWebhook() unconditionally, but the five notifications reachable through alwaysSendEvents did not implement it, so enabling the webhook channel turned those events into fatal queued jobs.
This commit is contained in:
@@ -100,4 +100,16 @@ class ApiTokenExpiringNotification extends CustomEmailNotification
|
||||
color: SlackMessage::warningColor(),
|
||||
);
|
||||
}
|
||||
|
||||
public function toWebhook(): array
|
||||
{
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => "API token '{$this->tokenName}' expires on {$this->expiresAt}. Rotate this token before it expires to avoid API outages.",
|
||||
'event' => 'api_token_expiring',
|
||||
'token_name' => $this->tokenName,
|
||||
'expires_at' => $this->expiresAt,
|
||||
'url' => $this->manageUrl,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +58,14 @@ class GeneralNotification extends Notification implements ShouldQueue
|
||||
color: SlackMessage::infoColor(),
|
||||
);
|
||||
}
|
||||
|
||||
public function toWebhook(): array
|
||||
{
|
||||
return [
|
||||
'success' => true,
|
||||
'message' => $this->message,
|
||||
'event' => 'general',
|
||||
'url' => base_url(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,4 +74,16 @@ class ForceDisabled extends CustomEmailNotification
|
||||
color: SlackMessage::errorColor()
|
||||
);
|
||||
}
|
||||
|
||||
public function toWebhook(): array
|
||||
{
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => "Server ({$this->server->name}) disabled because it is not paid! All automations and integrations are stopped.",
|
||||
'event' => 'server_force_disabled',
|
||||
'server_name' => $this->server->name,
|
||||
'server_uuid' => $this->server->uuid,
|
||||
'url' => base_url().'/server/'.$this->server->uuid,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +65,16 @@ class ForceEnabled extends CustomEmailNotification
|
||||
color: SlackMessage::successColor()
|
||||
);
|
||||
}
|
||||
|
||||
public function toWebhook(): array
|
||||
{
|
||||
return [
|
||||
'success' => true,
|
||||
'message' => "Server ({$this->server->name}) enabled again!",
|
||||
'event' => 'server_force_enabled',
|
||||
'server_name' => $this->server->name,
|
||||
'server_uuid' => $this->server->uuid,
|
||||
'url' => base_url().'/server/'.$this->server->uuid,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,4 +148,18 @@ class SslExpirationNotification extends CustomEmailNotification
|
||||
color: SlackMessage::warningColor()
|
||||
);
|
||||
}
|
||||
|
||||
public function toWebhook(): array
|
||||
{
|
||||
$resourceNames = $this->resources->pluck('name');
|
||||
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => "SSL certificates have been renewed for: {$resourceNames->join(', ')}. These resources need to be redeployed manually for the new SSL certificates to take effect.",
|
||||
'event' => 'ssl_certificate_renewal',
|
||||
'resources' => $resourceNames->values()->all(),
|
||||
'urls' => $this->urls,
|
||||
'url' => base_url(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user