mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-26 01:10:30 -04:00
fix(application): allow general saves with wildcard domains (#11683)
This commit is contained in:
@@ -145,7 +145,9 @@ class General extends Component
|
||||
return [
|
||||
'name' => ValidationPatterns::nameRules(),
|
||||
'description' => ValidationPatterns::descriptionRules(),
|
||||
'fqdn' => ValidationPatterns::applicationDomainRules(),
|
||||
'fqdn' => isset($this->application) && $this->fqdn === $this->application->fqdn
|
||||
? ['nullable']
|
||||
: ValidationPatterns::applicationDomainRules(),
|
||||
'parsedServiceDomains.*.domain' => ValidationPatterns::applicationDomainRules(),
|
||||
'gitRepository' => 'required',
|
||||
'gitBranch' => ['required', 'string', new ValidGitBranch],
|
||||
@@ -757,8 +759,11 @@ class General extends Component
|
||||
$oldDockerComposeLocation = $this->initialDockerComposeLocation;
|
||||
$oldBaseDirectory = $this->application->base_directory;
|
||||
|
||||
// Process FQDN with intermediate variable to avoid Collection/string confusion
|
||||
$this->fqdn = ValidationPatterns::normalizeApplicationDomains($this->fqdn);
|
||||
$fqdnChanged = $this->fqdn !== $this->application->fqdn;
|
||||
if ($fqdnChanged) {
|
||||
$this->fqdn = ValidationPatterns::normalizeApplicationDomains($this->fqdn);
|
||||
}
|
||||
|
||||
$warning = sslipDomainWarning($this->fqdn);
|
||||
if ($warning) {
|
||||
$this->dispatch('warning', __('warning.sslipdomain'));
|
||||
|
||||
@@ -102,3 +102,28 @@ test('can clear application domains via empty string and save successfully', fun
|
||||
$application->refresh();
|
||||
expect($application->fqdn)->toBeNull();
|
||||
});
|
||||
|
||||
test('can update general settings when the application has a wildcard domain', function () {
|
||||
$application = Application::factory()->create([
|
||||
'environment_id' => $this->environment->id,
|
||||
'destination_id' => $this->destination->id,
|
||||
'destination_type' => StandaloneDocker::class,
|
||||
'build_pack' => 'nixpacks',
|
||||
'fqdn' => 'https://example.com,https://*.example.com',
|
||||
'static_image' => 'nginx:alpine',
|
||||
'base_directory' => '/',
|
||||
'ports_exposes' => '3000',
|
||||
'is_http_basic_auth_enabled' => false,
|
||||
'redirect' => 'no',
|
||||
]);
|
||||
|
||||
Livewire::test(General::class, ['application' => $application])
|
||||
->assertSuccessful()
|
||||
->set('startCommand', 'node scripts/serve-prod.mjs')
|
||||
->call('submit', false)
|
||||
->assertHasNoErrors();
|
||||
|
||||
$application->refresh();
|
||||
expect($application->fqdn)->toBe('https://example.com,https://*.example.com')
|
||||
->and($application->start_command)->toBe('node scripts/serve-prod.mjs');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user