Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(notifications): urls for ssl renewal notifications

peaklabs-dev0eb9d5e5a895
diff --git a/app/Jobs/RegenerateSslCertJob.php b/app/Jobs/RegenerateSslCertJob.php
index 6f49cf30be..ed2d1c4546 100644
--- a/app/Jobs/RegenerateSslCertJob.php
+++ b/app/Jobs/RegenerateSslCertJob.php
@@ -66,7 +66,10 @@ class RegenerateSslCertJob implements ShouldBeEncrypted, ShouldQueue
caCert: $caCert->ssl_certificate,
caKey: $caCert->ssl_private_key,
);
- $regenerated->push($certificate);
+ $resource = $certificate->database;
+ if ($resource) {
+ $regenerated->push($resource);
+ }
} catch (\Exception $e) {
Log::error('Failed to regenerate SSL certificate: '.$e->getMessage());
}
diff --git a/app/Notifications/SslExpirationNotification.php b/app/Notifications/SslExpirationNotification.php
index 78e1e8be9c..023031ddd7 100644
--- a/app/Notifications/SslExpirationNotification.php
+++ b/app/Notifications/SslExpirationNotification.php
@@ -7,7 +7,6 @@ use App\Notifications\Dto\PushoverMessage;
use App\Notifications\Dto\SlackMessage;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Collection;
-use Spatie\Url\Url;
class SslExpirationNotification extends CustomEmailNotification
{
@@ -19,39 +18,9 @@ class SslExpirationNotification extends CustomEmailNotification
{
$this->onQueue('high');
$this->resources = collect($resources);
-
- // Collect URLs for each resource
- $this->resources->each(function ($resource) {
- if (data_get($resource, 'environment.project.uuid')) {
- $routeName = match ($resource->type()) {
- 'application' => 'project.application.configuration',
- 'database' => 'project.database.configuration',
- 'service' => 'project.service.configuration',
- default => null
- };
-
- if ($routeName) {
- $route = route($routeName, [
- 'project_uuid' => data_get($resource, 'environment.project.uuid'),
- 'environment_uuid' => data_get($resource, 'environment.uuid'),
- $resource->type().'_uuid' => data_get($resource, 'uuid'),
- ]);
-
- $settings = instanceSettings();
- if (data_get($settings, 'fqdn')) {
- $url = Url::fromString($route);
- $url = $url->withPort(null);
- $fqdn = data_get($settings, 'fqdn');
- $fqdn = str_replace(['http://', 'https://'], '', $fqdn);
- $url = $url->withHost($fqdn);
-
- $this->urls[$resource->name] = $url->__toString();
- } else {
- $this->urls[$resource->name] = $route;
- }
- }
- }
- });
+ $this->urls = $this->resources->mapWithKeys(fn ($resource) => [
+ $resource->name => base_url().'/project/'.data_get($resource, 'environment.project.uuid').'/environment/'.data_get($resource, 'environment.uuid')."/database/{$resource->uuid}",
+ ])->all();
}
public function via(object $notifiable): array