fix: dns validation + duplicated fqdns

This commit is contained in:
Andras Bacsai
2024-01-30 09:22:34 +01:00
parent 73d0948734
commit 3ae9501814
6 changed files with 46 additions and 7 deletions

View File

@@ -245,9 +245,10 @@ class General extends Component
$domains = $domains->unique();
foreach ($domains as $domain) {
if (!validate_dns_entry($domain, $this->application->destination->server)) {
$showToaster && $this->dispatch('error', "Validating DNS settings for: $domain failed.<br>Make sure you have added the DNS records correctly.<br><br>Check this <a target='_blank' class='underline' href='https://coolify.io/docs/dns-settings'>documentation</a> for further help.");
$showToaster && $this->dispatch('error', "Validating DNS ($domain) failed.","Make sure you have added the DNS records correctly.<br><br>Check this <a target='_blank' class='text-white underline' href='https://coolify.io/docs/dns-settings'>documentation</a> for further help.");
}
}
check_fqdn_usage($this->application);
$this->application->fqdn = $domains->implode(',');
}

View File

@@ -53,6 +53,7 @@ class Application extends Component
public function submit()
{
try {
check_fqdn_usage($this->application);
$this->validate();
$this->application->save();
updateCompose($this->application);

View File

@@ -1116,4 +1116,12 @@ class Application extends BaseModel
$this->save();
return $customLabels;
}
public function fqdns(): Attribute
{
return Attribute::make(
get: fn () => is_null($this->fqdn)
? []
: explode(',', $this->fqdn),
);
}
}

View File

@@ -55,7 +55,6 @@ class ServiceApplication extends BaseModel
get: fn () => is_null($this->fqdn)
? []
: explode(',', $this->fqdn),
);
}
public function getFilesFromServer(bool $isInit = false)