Created
August 29, 2016 21:11
-
-
Save arenowebdev/d67dd609ecff5d6cae55febb8f64c383 to your computer and use it in GitHub Desktop.
Sentry .env in Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In .env: | |
SENTRY_PRIVATE_DSN=https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy@app.getsentry.com/##### | |
SENTRY_PUBLIC_DSN=https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@app.getsentry.com/##### | |
// On our config server, each environment receives their own version of the .env file | |
// Depending upon the environment being deployed to, we grab that config and place it | |
// within the app directory. Now when the sentry config is used, it will have the environment | |
// specific configuration and will report exceptions for the environment that is being | |
// tested against. | |
// /config/sentry.php | |
return [ | |
'public_dsn' => env('SENTRY_PUBLIC_DSN'), | |
'dsn' => env('SENTRY_PRIVATE_DSN'), | |
'release' => trim(exec('git describe --tags --always --long')), | |
]; | |
// app/Exceptions/Handler.php | |
// ... | |
public function report(Exception $e) | |
{ | |
if ($this->shouldReport($e)) { | |
app('sentry')->captureException($e); | |
} | |
return parent::report($e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment