Skip to content

Commit

Permalink
Cleanup settings use in panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed Dec 30, 2017
1 parent 59b50ca commit 1b9b92a
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DB_DATABASE=panel
DB_USERNAME=pterodactyl
DB_PASSWORD=

CACHE_DRIVER=file
CACHE_DRIVER=
SESSION_DRIVER=

HASHIDS_SALT=
Expand Down
11 changes: 8 additions & 3 deletions app/Console/Commands/Environment/AppSettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class AppSettingsCommand extends Command
{--queue= : The queue driver backend to use.}
{--redis-host= : Redis host to use for connections.}
{--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
Expand Down Expand Up @@ -135,8 +136,12 @@ public function handle()
self::ALLOWED_QUEUE_DRIVERS,
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->writeToEnvironment($this->variables);
Expand Down
12 changes: 12 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ public function boot()
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.
*
Expand Down
4 changes: 0 additions & 4 deletions app/Providers/SettingsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ class SettingsServiceProvider extends ServiceProvider
*/
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
// are configured using SMTP as the driver.
if ($config->get('mail.driver') === 'smtp') {
Expand Down
1 change: 0 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
/*
* Application Service Providers...
*/
Pterodactyl\Providers\SettingsServiceProvider::class,
Pterodactyl\Providers\AppServiceProvider::class,
Pterodactyl\Providers\AuthServiceProvider::class,
Pterodactyl\Providers\EventServiceProvider::class,
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="MAIL_DRIVER" value="array"/>
<env name="APP_ENVIRONMENT_ONLY" value="true"/>
</php>
</phpunit>
8 changes: 1 addition & 7 deletions resources/lang/en/command/messages.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/

return [
'location' => [
Expand Down Expand Up @@ -74,6 +67,7 @@
'try_again' => 'Go back and try again?',
],
'app' => [
'settings' => 'Enable UI based settings editor?',
'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.',
'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.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@include('partials/admin.settings.notice')

@section('settings::nav')
@yield('settings::notice')
<div class="row">
<div class="col-xs-12">
<div class="nav-tabs-custom nav-tabs-floating">
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1b9b92a

Please sign in to comment.