fix(application): allow general saves with wildcard domains (#11683)
This commit is contained in:
parent
4cb806b472
commit
abc701ac65
2 changed files with 33 additions and 3 deletions
|
|
@ -145,7 +145,9 @@ protected function rules(): array
|
|||
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 @@ public function submit($showToaster = true)
|
|||
$oldDockerComposeLocation = $this->initialDockerComposeLocation;
|
||||
$oldBaseDirectory = $this->application->base_directory;
|
||||
|
||||
// Process FQDN with intermediate variable to avoid Collection/string confusion
|
||||
$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 @@
|
|||
$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');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue