Skip to content

Commit 1b9b92a

Browse files
committed
Cleanup settings use in panel.
1 parent 59b50ca commit 1b9b92a

File tree

9 files changed

+36
-17
lines changed

9 files changed

+36
-17
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ DB_DATABASE=panel
1414
DB_USERNAME=pterodactyl
1515
DB_PASSWORD=
1616

17-
CACHE_DRIVER=file
17+
CACHE_DRIVER=
1818
SESSION_DRIVER=
1919

2020
HASHIDS_SALT=

app/Console/Commands/Environment/AppSettingsCommand.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ class AppSettingsCommand extends Command
6666
{--queue= : The queue driver backend to use.}
6767
{--redis-host= : Redis host to use for connections.}
6868
{--redis-pass= : Password used to connect to redis.}
69-
{--redis-port= : Port to connect to redis over.}';
69+
{--redis-port= : Port to connect to redis over.}
70+
{--disable-settings-ui}';
7071

7172
/**
7273
* @var array
@@ -135,8 +136,12 @@ public function handle()
135136
self::ALLOWED_QUEUE_DRIVERS,
136137
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
137138
);
138-
139-
$this->variables['APP_ENVIRONMENT_ONLY'] = false;
139+
140+
if ($this->option('disable-settings-ui')) {
141+
$this->variables['APP_ENVIRONMENT_ONLY'] = true;
142+
} else {
143+
$this->variables['APP_ENVIRONMENT_ONLY'] = ! $this->confirm(trans('command/messages.environment.app.settings'), true);
144+
}
140145

141146
$this->checkForRedis();
142147
$this->writeToEnvironment($this->variables);

app/Providers/AppServiceProvider.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ public function boot()
3030
View::share('appIsGit', $this->versionData()['is_git'] ?? false);
3131
}
3232

33+
/**
34+
* Register application service providers.
35+
*/
36+
public function register()
37+
{
38+
// Only load the settings service provider if the environment
39+
// is configured to allow it.
40+
if (! config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') {
41+
$this->app->register(SettingsServiceProvider::class);
42+
}
43+
}
44+
3345
/**
3446
* Return version information for the footer.
3547
*

app/Providers/SettingsServiceProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ class SettingsServiceProvider extends ServiceProvider
6464
*/
6565
public function boot(ConfigRepository $config, Encrypter $encrypter, SettingsRepositoryInterface $settings)
6666
{
67-
if ($config->get('pterodactyl.load_environment_only', false)) {
68-
return;
69-
}
70-
7167
// Only set the email driver settings from the database if we
7268
// are configured using SMTP as the driver.
7369
if ($config->get('mail.driver') === 'smtp') {

config/app.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@
173173
/*
174174
* Application Service Providers...
175175
*/
176-
Pterodactyl\Providers\SettingsServiceProvider::class,
177176
Pterodactyl\Providers\AppServiceProvider::class,
178177
Pterodactyl\Providers\AuthServiceProvider::class,
179178
Pterodactyl\Providers\EventServiceProvider::class,

phpunit.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@
3232
<env name="SESSION_DRIVER" value="array"/>
3333
<env name="QUEUE_DRIVER" value="sync"/>
3434
<env name="MAIL_DRIVER" value="array"/>
35-
<env name="APP_ENVIRONMENT_ONLY" value="true"/>
3635
</php>
3736
</phpunit>

resources/lang/en/command/messages.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
<?php
2-
/**
3-
* Pterodactyl - Panel
4-
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5-
*
6-
* This software is licensed under the terms of the MIT license.
7-
* https://opensource.org/licenses/MIT
8-
*/
92

103
return [
114
'location' => [
@@ -74,6 +67,7 @@
7467
'try_again' => 'Go back and try again?',
7568
],
7669
'app' => [
70+
'settings' => 'Enable UI based settings editor?',
7771
'author' => 'Egg Author Email',
7872
'author_help' => 'Provide the email address that eggs exported by this Panel should be from. This should be a valid email address.',
7973
'app_url_help' => 'The application URL MUST begin with https:// or http:// depending on if you are using SSL or not. If you do not include the scheme your emails and other content will link to the wrong location.',

resources/themes/pterodactyl/partials/admin/settings/nav.blade.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
@include('partials/admin.settings.notice')
2+
13
@section('settings::nav')
4+
@yield('settings::notice')
25
<div class="row">
36
<div class="col-xs-12">
47
<div class="nav-tabs-custom nav-tabs-floating">
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@section('settings::notice')
2+
@if(config('pterodactyl.load_environment_only', false))
3+
<div class="row">
4+
<div class="col-xs-12">
5+
<div class="alert alert-danger">
6+
Your Panel is currently configured to read settings from the environment only. You will need to set <code>LOAD_ENVIRONMENT_ONLY=false</code> in your environment file in order to load settings dynamically.
7+
</div>
8+
</div>
9+
</div>
10+
@endif
11+
@endsection

0 commit comments

Comments
 (0)