Update WildcardDomain.php

This commit is contained in:
Bozhidar 2024-05-14 11:14:14 +03:00
parent abff1cd498
commit bd13837008

View file

@ -18,7 +18,7 @@ use Illuminate\Support\Str;
use Modules\LetsEncrypt\Filament\Clusters\LetsEncryptCluster; use Modules\LetsEncrypt\Filament\Clusters\LetsEncryptCluster;
use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings; use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
class WildcardMasterDomain extends BaseSettings class WildcardDomain extends BaseSettings
{ {
protected static ?string $navigationGroup = 'Let\'s Encrypt'; protected static ?string $navigationGroup = 'Let\'s Encrypt';
@ -35,7 +35,7 @@ class WildcardMasterDomain extends BaseSettings
public static function getNavigationLabel() : string public static function getNavigationLabel() : string
{ {
return 'Wildcard Master Domain'; return 'Wildcard Domain';
} }
public function getFormActions() : array public function getFormActions() : array
{ {
@ -47,6 +47,7 @@ class WildcardMasterDomain extends BaseSettings
public function installCertificates() public function installCertificates()
{ {
$masterDomain = new MasterDomain(); $masterDomain = new MasterDomain();
$masterDomain->domain = setting('general.wildcard_domain');
if (file_exists($this->installLogFilePath)) { if (file_exists($this->installLogFilePath)) {
unlink($this->installLogFilePath); unlink($this->installLogFilePath);
@ -61,6 +62,7 @@ class WildcardMasterDomain extends BaseSettings
'locality' => $masterDomain->locality, 'locality' => $masterDomain->locality,
'organization' => $masterDomain->organization 'organization' => $masterDomain->organization
])->render(); ])->render();
$acmeConfigYaml = preg_replace('~(*ANY)\A\s*\R|\s*(?!\r\n)\s$~mu', '', $acmeConfigYaml); $acmeConfigYaml = preg_replace('~(*ANY)\A\s*\R|\s*(?!\r\n)\s$~mu', '', $acmeConfigYaml);
file_put_contents($masterDomain->domainRoot.'/acme-wildcard-config.yaml', $acmeConfigYaml); file_put_contents($masterDomain->domainRoot.'/acme-wildcard-config.yaml', $acmeConfigYaml);
@ -176,9 +178,9 @@ class WildcardMasterDomain extends BaseSettings
Wizard\Step::make('Install') Wizard\Step::make('Install')
//->description('Install a wildcard SSL certificate for the master domain') //->description('Install a wildcard SSL certificate for the master domain')
->schema([ ->schema([
TextInput::make('master_domain') TextInput::make('wildcard_domain')
->helperText('Install a wildcard SSL certificate for the master domain') ->helperText('Install a wildcard SSL certificate for the master domain')
->placeholder(setting('general.master_domain')) ->placeholder(setting('general.wildcard_domain'))
->disabled(), ->disabled(),
])->afterValidation(function () { ])->afterValidation(function () {
if (file_exists($this->installLogFilePath)) { if (file_exists($this->installLogFilePath)) {