mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
- Proxy: list and delete Traefik ACME certificates from the server proxy page via new TraefikAcmeService and Get/DeleteTraefikCertificate actions - DNS: track ownership and cross-resource references for managed DNS records so records are only deleted when no longer referenced; release records asynchronously on resource deletion via ReleaseManagedDnsRecordsJob and ManagedDnsRecordCleanup; harden Cloudflare provider deletion results - Databases: fail closed on start when prerequisites or the CA certificate are missing (DatabaseStartException, Server::ensureCaCertificate) and clean up stale start activities via ResourceStartActivity - Webhooks: throttle repeated manual webhook signature failures for GitHub, GitLab, Gitea and Bitbucket - Deployments: improve compose build-context handling and compose file load error reporting - Install scripts: rework terminal UI output in install.sh (stable and nightly) - Misc: settings sidebar accordion fixes, log drain toggle rollback, add Serverside to README sponsors - Add migrations and tests covering the above
66 lines
1.7 KiB
PHP
66 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class ManagedDnsRecord extends BaseModel
|
|
{
|
|
use HasFactory;
|
|
|
|
public const OWNERSHIP_COMMENT_PREFIX = 'managed-by: coolify';
|
|
|
|
protected $fillable = [
|
|
'uuid', 'team_id', 'integration_token_id', 'dns_provider_zone_id',
|
|
'provider_record_id', 'type', 'name', 'content', 'owned',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'owned' => 'boolean',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* The provider comment that proves Coolify created this record. Records without it are never modified or deleted automatically.
|
|
*/
|
|
public static function ownershipCommentFor(string $uuid): string
|
|
{
|
|
$instanceId = substr((string) (config('app.id') ?: 'default'), 0, 40);
|
|
|
|
return self::OWNERSHIP_COMMENT_PREFIX." {$instanceId}/{$uuid}";
|
|
}
|
|
|
|
public function ownershipComment(): string
|
|
{
|
|
return self::ownershipCommentFor($this->uuid);
|
|
}
|
|
|
|
public function zone(): BelongsTo
|
|
{
|
|
return $this->belongsTo(DnsProviderZone::class, 'dns_provider_zone_id');
|
|
}
|
|
|
|
public function integrationToken(): BelongsTo
|
|
{
|
|
return $this->belongsTo(IntegrationToken::class);
|
|
}
|
|
|
|
public function references(): HasMany
|
|
{
|
|
return $this->hasMany(ManagedDnsRecordReference::class);
|
|
}
|
|
|
|
public function addReference(Model $resource): ManagedDnsRecordReference
|
|
{
|
|
return $this->references()->firstOrCreate([
|
|
'resource_type' => $resource->getMorphClass(),
|
|
'resource_id' => $resource->getKey(),
|
|
]);
|
|
}
|
|
}
|