mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 14:34:44 +02:00
Settings page followup (#514)
* remove group for toggle buttons * fix default for APP_DEBUG * correctly handle bool values * fix pint * small cleanup for example .env
This commit is contained in:
parent
a58e159478
commit
3f40256f8b
@ -26,11 +26,7 @@ MAIL_FROM_ADDRESS=no-reply@example.com
|
|||||||
MAIL_FROM_NAME="Pelican Admin"
|
MAIL_FROM_NAME="Pelican Admin"
|
||||||
# Set this to your domain to prevent it defaulting to 'localhost', causing mail servers such as Gmail to reject your mail
|
# Set this to your domain to prevent it defaulting to 'localhost', causing mail servers such as Gmail to reject your mail
|
||||||
# MAIL_EHLO_DOMAIN=panel.example.com
|
# MAIL_EHLO_DOMAIN=panel.example.com
|
||||||
|
|
||||||
SESSION_ENCRYPT=false
|
SESSION_ENCRYPT=false
|
||||||
SESSION_PATH=/
|
SESSION_PATH=/
|
||||||
SESSION_DOMAIN=null
|
SESSION_DOMAIN=null
|
||||||
|
|
||||||
# Set this to true, and set start & end ports to auto create allocations.
|
|
||||||
PANEL_CLIENT_ALLOCATIONS_ENABLED=false
|
|
||||||
PANEL_CLIENT_ALLOCATIONS_RANGE_START=
|
|
||||||
PANEL_CLIENT_ALLOCATIONS_RANGE_END=
|
|
||||||
|
@ -102,10 +102,10 @@ class Settings extends Page implements HasForms
|
|||||||
->offColor('danger')
|
->offColor('danger')
|
||||||
->formatStateUsing(fn ($state): bool => (bool) $state)
|
->formatStateUsing(fn ($state): bool => (bool) $state)
|
||||||
->afterStateUpdated(fn ($state, Set $set) => $set('APP_DEBUG', (bool) $state))
|
->afterStateUpdated(fn ($state, Set $set) => $set('APP_DEBUG', (bool) $state))
|
||||||
->default(env('RECAPTCHA_ENABLED', config('recaptcha.enabled'))),
|
->default(env('APP_DEBUG', config('app.debug'))),
|
||||||
ToggleButtons::make('FILAMENT_TOP_NAVIGATION')
|
ToggleButtons::make('FILAMENT_TOP_NAVIGATION')
|
||||||
->label('Navigation')
|
->label('Navigation')
|
||||||
->grouped()
|
->inline()
|
||||||
->options([
|
->options([
|
||||||
false => 'Sidebar',
|
false => 'Sidebar',
|
||||||
true => 'Topbar',
|
true => 'Topbar',
|
||||||
@ -115,7 +115,7 @@ class Settings extends Page implements HasForms
|
|||||||
->default(env('FILAMENT_TOP_NAVIGATION', config('panel.filament.top-navigation'))),
|
->default(env('FILAMENT_TOP_NAVIGATION', config('panel.filament.top-navigation'))),
|
||||||
ToggleButtons::make('PANEL_USE_BINARY_PREFIX')
|
ToggleButtons::make('PANEL_USE_BINARY_PREFIX')
|
||||||
->label('Unit prefix')
|
->label('Unit prefix')
|
||||||
->grouped()
|
->inline()
|
||||||
->options([
|
->options([
|
||||||
false => 'Decimal Prefix (MB/ GB)',
|
false => 'Decimal Prefix (MB/ GB)',
|
||||||
true => 'Binary Prefix (MiB/ GiB)',
|
true => 'Binary Prefix (MiB/ GiB)',
|
||||||
@ -125,7 +125,7 @@ class Settings extends Page implements HasForms
|
|||||||
->default(env('PANEL_USE_BINARY_PREFIX', config('panel.use_binary_prefix'))),
|
->default(env('PANEL_USE_BINARY_PREFIX', config('panel.use_binary_prefix'))),
|
||||||
ToggleButtons::make('APP_2FA_REQUIRED')
|
ToggleButtons::make('APP_2FA_REQUIRED')
|
||||||
->label('2FA Requirement')
|
->label('2FA Requirement')
|
||||||
->grouped()
|
->inline()
|
||||||
->options([
|
->options([
|
||||||
0 => 'Not required',
|
0 => 'Not required',
|
||||||
1 => 'Required for only Admins',
|
1 => 'Required for only Admins',
|
||||||
@ -209,7 +209,7 @@ class Settings extends Page implements HasForms
|
|||||||
ToggleButtons::make('MAIL_MAILER')
|
ToggleButtons::make('MAIL_MAILER')
|
||||||
->label('Mail Driver')
|
->label('Mail Driver')
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->grouped()
|
->inline()
|
||||||
->options([
|
->options([
|
||||||
'log' => 'Print mails to Log',
|
'log' => 'Print mails to Log',
|
||||||
'smtp' => 'SMTP Server',
|
'smtp' => 'SMTP Server',
|
||||||
@ -284,7 +284,7 @@ class Settings extends Page implements HasForms
|
|||||||
ToggleButtons::make('MAIL_ENCRYPTION')
|
ToggleButtons::make('MAIL_ENCRYPTION')
|
||||||
->label('SMTP encryption')
|
->label('SMTP encryption')
|
||||||
->required()
|
->required()
|
||||||
->grouped()
|
->inline()
|
||||||
->options(['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'])
|
->options(['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'])
|
||||||
->default(env('MAIL_ENCRYPTION', config('mail.mailers.smtp.encryption', 'tls'))),
|
->default(env('MAIL_ENCRYPTION', config('mail.mailers.smtp.encryption', 'tls'))),
|
||||||
]),
|
]),
|
||||||
@ -314,7 +314,7 @@ class Settings extends Page implements HasForms
|
|||||||
ToggleButtons::make('APP_BACKUP_DRIVER')
|
ToggleButtons::make('APP_BACKUP_DRIVER')
|
||||||
->label('Backup Driver')
|
->label('Backup Driver')
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->grouped()
|
->inline()
|
||||||
->options([
|
->options([
|
||||||
Backup::ADAPTER_DAEMON => 'Wings',
|
Backup::ADAPTER_DAEMON => 'Wings',
|
||||||
Backup::ADAPTER_AWS_S3 => 'S3',
|
Backup::ADAPTER_AWS_S3 => 'S3',
|
||||||
@ -532,6 +532,9 @@ class Settings extends Page implements HasForms
|
|||||||
try {
|
try {
|
||||||
$data = $this->form->getState();
|
$data = $this->form->getState();
|
||||||
|
|
||||||
|
// Convert bools to a string, so they are correctly written to the .env file
|
||||||
|
$data = array_map(fn ($value) => is_bool($value) ? ($value ? 'true' : 'false') : $value, $data);
|
||||||
|
|
||||||
$this->writeToEnvironment($data);
|
$this->writeToEnvironment($data);
|
||||||
|
|
||||||
Artisan::call('config:clear');
|
Artisan::call('config:clear');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user