Skip to content

Commit

Permalink
Also include sentry/sentry-laravel (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-GG authored Aug 13, 2024
1 parent 351f51d commit db5a436
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 49 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Rapidez Sentry
This package integrates Sentry Vue into a Rapidez project.
This package integrates Sentry Laravel and Sentry Vue into a Rapidez project.

## Installation

Expand All @@ -8,33 +8,36 @@ yarn add @sentry/vue --dev
composer require rapidez/sentry
```

You will need to add the following line to your .env:
You will need to add the following lines to your .env:

```
VITE_SENTRY_DSN=[your sentry DSN url here]
SENTRY_LARAVEL_DSN=___PUBLIC_DSN___
VITE_SENTRY_DSN="${SENTRY_LARAVEL_DSN}"
```

Setting your Sentry DSN to be public like this is [safe](https://docs.sentry.io/concepts/key-terms/dsn-explainer/).
You don't need the `VITE_SENTRY_DSN` line if you don't want to use the Sentry Vue package. Note that setting your Sentry DSN to be public like this is [safe](https://docs.sentry.io/concepts/key-terms/dsn-explainer/).

You can also disable this package in your .env by adding:
You can disable the Vue package in your .env by adding:

```
SENTRY_ENABLED=false
SENTRY_VUE_ENABLED=false
```

## Configuration

You can publish the config with:
You can publish the (vue-specific) config with:
```
php artisan vendor:publish --tag=rapidez-sentry-config
```

Some basic configuration settings can also be set in your env, for example:
Some basic configuration settings for Vue can also be set in your env, for example:
```
SENTRY_SAMPLE_RATE=50
SENTRY_INTEGRATION_REPLAY=true
SENTRY_VUE_SAMPLE_RATE=50
SENTRY_VUE_INTEGRATION_REPLAY=true
```

Check out the [sentry/sentry-laravel readme](https://github.com/getsentry/sentry-laravel) for configuration of the laravel package.

## License

GNU General Public License v3. Please see [License File](LICENSE) for more information.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"prefer-stable": true,
"require": {
"php": "^8.1|^8.2|^8.3",
"rapidez/core": "^1.0|^2.0"
"rapidez/core": "^1.0|^2.0",
"sentry/sentry-laravel": "^4.7"
},
"autoload": {
"psr-4": {
Expand Down
33 changes: 33 additions & 0 deletions config/rapidez/sentry-vue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

return [
// Configuration as defined in the docs: https://docs.sentry.io/platforms/javascript/guides/vue/configuration/
'configuration' => [
'enabled' => env('SENTRY_VUE_ENABLED', true),

// Amount of errors to be logged to sentry (1.00 = 100%)
'sampleRate' => env('SENTRY_VUE_SAMPLE_RATE', 100) / 100,
],

// For integrations, see: https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/
// If you want to add extra configuration to the constructor of an integration, change the `true` to an array like so:
// 'replay' => [
// 'maskAllText' => true,
// 'blockAllMedia' => true,
// ],
'integrations' => [
'browserProfiling' => env('SENTRY_VUE_INTEGRATION_BROWSER_PROFILING', false),
'browserTracing' => env('SENTRY_VUE_INTEGRATION_BROWSER_TRACING', false),
'captureConsole' => env('SENTRY_VUE_INTEGRATION_CAPTURE_CONSOLE', false),
'contextLines' => env('SENTRY_VUE_INTEGRATION_CONTEXT_LINES', false),
'debug' => env('SENTRY_VUE_INTEGRATION_DEBUG', false),
'extraErrorData' => env('SENTRY_VUE_INTEGRATION_EXTRA_ERROR_DATA', false),
'httpClient' => env('SENTRY_VUE_INTEGRATION_HTTP_CLIENT', false),
'moduleMetadata' => env('SENTRY_VUE_INTEGRATION_MODULE_METADATA', false),
'rewriteFrames' => env('SENTRY_VUE_INTEGRATION_REWRITE_FRAMES', false),
'replay' => env('SENTRY_VUE_INTEGRATION_REPLAY', false),
'replayCanvas' => env('SENTRY_VUE_INTEGRATION_REPLAY_CANVAS', false),
'reportingObserver' => env('SENTRY_VUE_INTEGRATION_REPORTING_OBSERVER', false),
'sessionTiming' => env('SENTRY_VUE_INTEGRATION_SESSION_TIMING', false),
],
];
33 changes: 0 additions & 33 deletions config/rapidez/sentry.php

This file was deleted.

6 changes: 3 additions & 3 deletions src/Http/ViewComposers/ConfigComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class ConfigComposer
{
public function compose(View $view)
{
Config::set('frontend.sentry.configuration', config('rapidez.sentry.configuration'));
Config::set('frontend.sentry.enabled', config('rapidez.sentry.configuration.enabled'));
Config::set('frontend.sentry.integrations', config('rapidez.sentry.integrations'));
Config::set('frontend.sentry.configuration', config('rapidez.sentry-vue.configuration'));
Config::set('frontend.sentry.enabled', config('rapidez.sentry-vue.configuration.enabled'));
Config::set('frontend.sentry.integrations', config('rapidez.sentry-vue.integrations'));
}
}
4 changes: 2 additions & 2 deletions src/SentryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class SentryServiceProvider extends ServiceProvider
{
public function register()
{
$this->mergeConfigFrom(__DIR__.'/../config/rapidez/sentry.php', 'rapidez.sentry');
$this->mergeConfigFrom(__DIR__.'/../config/rapidez/sentry-vue.php', 'rapidez.sentry-vue');
}

public function boot()
{
$this->publishes([
__DIR__.'/../config/rapidez/sentry.php' => config_path('rapidez/sentry.php'),
__DIR__.'/../config/rapidez/sentry-vue.php' => config_path('rapidez/sentry-vue.php'),
], 'rapidez-sentry-config');

View::composer('rapidez::layouts.app', ConfigComposer::class);
Expand Down

0 comments on commit db5a436

Please sign in to comment.