Implement fix for console spam when using invalid environment variable values
This commit is contained in:
parent
1fcad8d86c
commit
d4758efef8
4 changed files with 51 additions and 26 deletions
12
.env.example
12
.env.example
|
@ -2,10 +2,10 @@ APP_ENV=production
|
|||
APP_DEBUG=false
|
||||
APP_KEY=SomeRandomString3232RandomString
|
||||
APP_THEME=pterodactyl
|
||||
APP_TIMEZONE=UTC
|
||||
APP_TIMEZONE=America/New_York
|
||||
APP_CLEAR_TASKLOG=720
|
||||
APP_DELETE_MINUTES=10
|
||||
APP_URL=http://yoursite.com/
|
||||
APP_URL=
|
||||
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
|
@ -13,8 +13,8 @@ DB_DATABASE=panel
|
|||
DB_USERNAME=pterodactyl
|
||||
DB_PASSWORD=
|
||||
|
||||
CACHE_DRIVER=redis
|
||||
SESSION_DRIVER=database
|
||||
CACHE_DRIVER=
|
||||
SESSION_DRIVER=
|
||||
|
||||
HASHIDS_SALT=
|
||||
HASHIDS_LENGTH=8
|
||||
|
@ -25,9 +25,9 @@ MAIL_PORT=2525
|
|||
MAIL_USERNAME=
|
||||
MAIL_PASSWORD=
|
||||
MAIL_ENCRYPTION=tls
|
||||
MAIL_FROM=you@example.com
|
||||
MAIL_FROM=no-reply@example.com
|
||||
|
||||
QUEUE_DRIVER=database
|
||||
QUEUE_DRIVER=
|
||||
QUEUE_HIGH=high
|
||||
QUEUE_STANDARD=standard
|
||||
QUEUE_LOW=low
|
||||
|
|
|
@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa
|
|||
|
||||
This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||
|
||||
## v0.7.0-beta.3 (Derelict Dermodactylus)
|
||||
### Fixed
|
||||
* `[beta.2]` — Fixes a bug that would cause an endless exception message stream in the console when attemping to setup environment settings in certain instances.
|
||||
|
||||
## v0.7.0-beta.2 (Derelict Dermodactylus)
|
||||
### Fixed
|
||||
* `[beta.1]` — Fixes a CORS header issue due to a wrong API endpoint being provided in the administrative node listing.
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
namespace Pterodactyl\Console\Commands\Environment;
|
||||
|
||||
use DateTimeZone;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
use Pterodactyl\Traits\Commands\EnvironmentWriterTrait;
|
||||
|
@ -18,6 +19,25 @@ class AppSettingsCommand extends Command
|
|||
{
|
||||
use EnvironmentWriterTrait;
|
||||
|
||||
const ALLOWED_CACHE_DRIVERS = [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'memcached' => 'Memcached'
|
||||
];
|
||||
|
||||
const ALLOWED_SESSION_DRIVERS = [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'memcached' => 'Memcached',
|
||||
'database' => 'MySQL Database',
|
||||
'file' => 'Filesystem',
|
||||
'cookie' => 'Cookie',
|
||||
];
|
||||
|
||||
const ALLOWED_QUEUE_DRIVERS = [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'database' => 'MySQL Database',
|
||||
'sync' => 'Sync',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Console\Kernel
|
||||
*/
|
||||
|
@ -37,11 +57,13 @@ class AppSettingsCommand extends Command
|
|||
* @var string
|
||||
*/
|
||||
protected $signature = 'p:environment:setup
|
||||
{--new-salt : Wether or not to generate a new salt for Hashids.}
|
||||
{--author= : The email that services created on this instance should be linked to.}
|
||||
{--url= : The URL that this Panel is running on.}
|
||||
{--timezone= : The timezone to use for Panel times.}
|
||||
{--cache= : The cache driver backend to use.}
|
||||
{--session= : The session driver backend to use.}
|
||||
{--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.}';
|
||||
|
@ -72,7 +94,7 @@ class AppSettingsCommand extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (empty($this->config->get('hashids.salt')) || $this->option('--new-salt')) {
|
||||
if (empty($this->config->get('hashids.salt')) || $this->option('new-salt')) {
|
||||
$this->variables['HASHIDS_SALT'] = str_random(20);
|
||||
}
|
||||
|
||||
|
@ -87,33 +109,31 @@ class AppSettingsCommand extends Command
|
|||
);
|
||||
|
||||
$this->output->comment(trans('command/messages.environment.app.timezone_help'));
|
||||
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->ask(
|
||||
trans('command/messages.environment.app.timezone'), $this->config->get('app.timezone')
|
||||
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
|
||||
trans('command/messages.environment.app.timezone'),
|
||||
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
|
||||
$this->config->get('app.timezone')
|
||||
);
|
||||
|
||||
$selected = $this->config->get('cache.default', 'redis');
|
||||
$this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice(
|
||||
trans('command/messages.environment.app.cache_driver'), [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'memcached' => 'Memcached',
|
||||
], $this->config->get('cache.default', 'redis')
|
||||
trans('command/messages.environment.app.cache_driver'),
|
||||
self::ALLOWED_CACHE_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
|
||||
);
|
||||
|
||||
$selected = $this->config->get('session.driver', 'redis');
|
||||
$this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice(
|
||||
trans('command/messages.environment.app.session_driver'), [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'memcached' => 'Memcached',
|
||||
'database' => 'MySQL Database',
|
||||
'file' => 'Filesystem',
|
||||
'cookie' => 'Cookie',
|
||||
], $this->config->get('session.driver', 'redis')
|
||||
trans('command/messages.environment.app.session_driver'),
|
||||
self::ALLOWED_SESSION_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
|
||||
);
|
||||
|
||||
$this->variables['QUEUE_DRIVER'] = $this->option('session') ?? $this->choice(
|
||||
trans('command/messages.environment.app.session_driver'), [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'database' => 'MySQL Database',
|
||||
'sync' => 'Sync',
|
||||
], $this->config->get('queue.driver', 'redis')
|
||||
$selected = $this->config->get('queue.default', 'redis');
|
||||
$this->variables['QUEUE_DRIVER'] = $this->option('queue') ?? $this->choice(
|
||||
trans('command/messages.environment.app.queue_driver'),
|
||||
self::ALLOWED_QUEUE_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
|
||||
);
|
||||
|
||||
$this->checkForRedis();
|
||||
|
|
|
@ -82,6 +82,7 @@ return [
|
|||
'timezone' => 'Application Timezone',
|
||||
'cache_driver' => 'Cache Driver',
|
||||
'session_driver' => 'Session Driver',
|
||||
'queue_driver' => 'Queue Driver',
|
||||
'using_redis' => 'You\'ve selected the Redis driver for one or more options, please provide valid connection information below. In most cases you can use the defaults provided unless you have modified your setup.',
|
||||
'redis_host' => 'Redis Host',
|
||||
'redis_password' => 'Redis Password',
|
||||
|
|
Loading…
Reference in a new issue