Cleanup settings use in panel.

This commit is contained in:
Dane Everitt 2017-12-30 16:33:00 -06:00
parent 59b50ca75e
commit 1b9b92ac62
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 36 additions and 17 deletions

View file

@ -14,7 +14,7 @@ DB_DATABASE=panel
DB_USERNAME=pterodactyl DB_USERNAME=pterodactyl
DB_PASSWORD= DB_PASSWORD=
CACHE_DRIVER=file CACHE_DRIVER=
SESSION_DRIVER= SESSION_DRIVER=
HASHIDS_SALT= HASHIDS_SALT=

View file

@ -66,7 +66,8 @@ class AppSettingsCommand extends Command
{--queue= : The queue driver backend to use.} {--queue= : The queue driver backend to use.}
{--redis-host= : Redis host to use for connections.} {--redis-host= : Redis host to use for connections.}
{--redis-pass= : Password used to connect to redis.} {--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.}'; {--redis-port= : Port to connect to redis over.}
{--disable-settings-ui}';
/** /**
* @var array * @var array
@ -136,7 +137,11 @@ class AppSettingsCommand extends Command
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
); );
$this->variables['APP_ENVIRONMENT_ONLY'] = false; if ($this->option('disable-settings-ui')) {
$this->variables['APP_ENVIRONMENT_ONLY'] = true;
} else {
$this->variables['APP_ENVIRONMENT_ONLY'] = ! $this->confirm(trans('command/messages.environment.app.settings'), true);
}
$this->checkForRedis(); $this->checkForRedis();
$this->writeToEnvironment($this->variables); $this->writeToEnvironment($this->variables);

View file

@ -30,6 +30,18 @@ class AppServiceProvider extends ServiceProvider
View::share('appIsGit', $this->versionData()['is_git'] ?? false); View::share('appIsGit', $this->versionData()['is_git'] ?? false);
} }
/**
* Register application service providers.
*/
public function register()
{
// Only load the settings service provider if the environment
// is configured to allow it.
if (! config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') {
$this->app->register(SettingsServiceProvider::class);
}
}
/** /**
* Return version information for the footer. * Return version information for the footer.
* *

View file

@ -64,10 +64,6 @@ class SettingsServiceProvider extends ServiceProvider
*/ */
public function boot(ConfigRepository $config, Encrypter $encrypter, SettingsRepositoryInterface $settings) public function boot(ConfigRepository $config, Encrypter $encrypter, SettingsRepositoryInterface $settings)
{ {
if ($config->get('pterodactyl.load_environment_only', false)) {
return;
}
// Only set the email driver settings from the database if we // Only set the email driver settings from the database if we
// are configured using SMTP as the driver. // are configured using SMTP as the driver.
if ($config->get('mail.driver') === 'smtp') { if ($config->get('mail.driver') === 'smtp') {

View file

@ -173,7 +173,6 @@ return [
/* /*
* Application Service Providers... * Application Service Providers...
*/ */
Pterodactyl\Providers\SettingsServiceProvider::class,
Pterodactyl\Providers\AppServiceProvider::class, Pterodactyl\Providers\AppServiceProvider::class,
Pterodactyl\Providers\AuthServiceProvider::class, Pterodactyl\Providers\AuthServiceProvider::class,
Pterodactyl\Providers\EventServiceProvider::class, Pterodactyl\Providers\EventServiceProvider::class,

View file

@ -32,6 +32,5 @@
<env name="SESSION_DRIVER" value="array"/> <env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/> <env name="QUEUE_DRIVER" value="sync"/>
<env name="MAIL_DRIVER" value="array"/> <env name="MAIL_DRIVER" value="array"/>
<env name="APP_ENVIRONMENT_ONLY" value="true"/>
</php> </php>
</phpunit> </phpunit>

View file

@ -1,11 +1,4 @@
<?php <?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
return [ return [
'location' => [ 'location' => [
@ -74,6 +67,7 @@ return [
'try_again' => 'Go back and try again?', 'try_again' => 'Go back and try again?',
], ],
'app' => [ 'app' => [
'settings' => 'Enable UI based settings editor?',
'author' => 'Egg Author Email', 'author' => 'Egg Author Email',
'author_help' => 'Provide the email address that eggs exported by this Panel should be from. This should be a valid email address.', 'author_help' => 'Provide the email address that eggs exported by this Panel should be from. This should be a valid email address.',
'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.', '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.',

View file

@ -1,4 +1,7 @@
@include('partials/admin.settings.notice')
@section('settings::nav') @section('settings::nav')
@yield('settings::notice')
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="nav-tabs-custom nav-tabs-floating"> <div class="nav-tabs-custom nav-tabs-floating">

View file

@ -0,0 +1,11 @@
@section('settings::notice')
@if(config('pterodactyl.load_environment_only', false))
<div class="row">
<div class="col-xs-12">
<div class="alert alert-danger">
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.
</div>
</div>
</div>
@endif
@endsection