Make error reports opt-in for all installations.

This commit is contained in:
Buster Neece 2019-03-22 21:01:37 -05:00
parent 48f104d8cd
commit 47ec65182a
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
4 changed files with 23 additions and 11 deletions

View File

@ -149,7 +149,18 @@ return [
],
'default' => Entity\Settings::UPDATES_RELEASE_ONLY,
]
]
],
Entity\Settings::SEND_ERROR_REPORTS => [
'toggle',
[
'label' => __('Automatically Send Error Reports to AzuraCast'),
'description' => __('If the web application encounters an error, you can choose to automatically send an anonymized report of the error to the AzuraCast team for faster diagnosis and resolution.'),
'selected_text' => __('Yes'),
'deselected_text' => __('No'),
'default' => false,
]
],
],
],

View File

@ -10,11 +10,11 @@ class Settings extends AbstractFixture
public function load(ObjectManager $em)
{
$settings = [
'base_url' => getenv('INIT_BASE_URL') ?? 'docker.local',
'gmaps_api_key' => getenv('INIT_GMAPS_API_KEY') ?? '',
'instance_name' => getenv('INIT_INSTANCE_NAME') ?? 'local test',
'setup_complete' => time(),
'use_radio_proxy' => 1,
Entity\Settings::BASE_URL => getenv('INIT_BASE_URL') ?? 'docker.local',
Entity\Settings::INSTANCE_NAME => getenv('INIT_INSTANCE_NAME') ?? 'local test',
Entity\Settings::SETUP_COMPLETE => time(),
Entity\Settings::USE_RADIO_PROXY => 1,
Entity\Settings::SEND_ERROR_REPORTS => 1,
];
/** @var Entity\Repository\SettingsRepository $settings_repo */

View File

@ -23,6 +23,7 @@ class Settings
public const LISTENER_ANALYTICS = 'analytics';
public const CENTRAL_UPDATES = 'central_updates_channel';
public const SEND_ERROR_REPORTS = 'send_error_reports';
// Custom branding constants.
public const PUBLIC_THEME = 'public_theme';

View File

@ -51,18 +51,18 @@ class Sentry
public function init(): void
{
// Check for enabled status.
if ($this->app_settings->isProduction()) {
return;
}
try {
$server_uuid = $this->settings_repo->getUniqueIdentifier();
$send_error_reports = (bool)$this->settings_repo->getSetting(Entity\Settings::SEND_ERROR_REPORTS, false);
if (!$send_error_reports) {
return;
}
} catch (\Doctrine\DBAL\Exception\TableNotFoundException $e) {
return;
}
$this->is_enabled = true;
$server_uuid = $this->settings_repo->getUniqueIdentifier();
$options = [
'dsn' => $this->app_settings['sentry_io']['dsn'],
'environment' => $this->app_settings[Settings::APP_ENV],