Add telemetry prompt in p:environment:setup command

This commit is contained in:
Matthew Penner 2022-12-04 14:59:45 -07:00
parent 250c557e23
commit fa7503816a
No known key found for this signature in database
3 changed files with 12 additions and 5 deletions

View file

@ -44,7 +44,8 @@ class AppSettingsCommand extends Command
{--redis-host= : Redis host to use for connections.}
{--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.}
{--settings-ui= : Enable or disable the settings UI.}';
{--settings-ui= : Enable or disable the settings UI.}
{--telemetry= : Enable or disable anonymous telemetry.}';
protected array $variables = [];
@ -119,6 +120,12 @@ class AppSettingsCommand extends Command
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm('Enable UI based settings editor?', true) ? 'false' : 'true';
}
$this->output->comment('Please reference https://pterodactyl.io/panel/1.0/additional_configuration.html#telemetry for more detailed information regarding telemetry data and collection.');
$this->variables['PTERODACTYL_TELEMETRY_ENABLED'] = $this->option('telemetry') ?? $this->confirm(
'Enable sending anonymous telemetry data?',
config('pterodactyl.telemetry.enabled', true)
) ? 'true' : 'false';
// Make sure session cookies are set as "secure" when using HTTPS
if (str_starts_with($this->variables['APP_URL'], 'https://')) {
$this->variables['SESSION_SECURE_COOKIE'] = 'true';

View file

@ -56,10 +56,10 @@ class Kernel extends ConsoleKernel
{
$settingsRepository = app()->make(SettingsRepository::class);
$uuid = $settingsRepository->get('app:uuid');
$uuid = $settingsRepository->get('app:telemetry:uuid');
if (is_null($uuid)) {
$uuid = Uuid::uuid4()->toString();
$settingsRepository->set('app:uuid', $uuid);
$settingsRepository->set('app:telemetry:uuid', $uuid);
}
// Calculate a fixed time to run the data push at, this will be the same time every day.

View file

@ -52,10 +52,10 @@ class TelemetryCollectionService
*/
public function collect(): array
{
$uuid = $this->settingsRepository->get('app:uuid');
$uuid = $this->settingsRepository->get('app:telemetry:uuid');
if (is_null($uuid)) {
$uuid = Uuid::uuid4()->toString();
$this->settingsRepository->set('app:uuid', $uuid);
$this->settingsRepository->set('app:telemetry:uuid', $uuid);
}
$nodes = Node::all()->map(function ($node) {