diff --git a/src/SentryAPI.php b/src/SentryAPI.php index a934cef..ef34a06 100644 --- a/src/SentryAPI.php +++ b/src/SentryAPI.php @@ -29,6 +29,10 @@ public static function createProject($name){ self::cURLRequest("https://sentry.io/api/0/teams/jesper-menting/jesper-menting/projects/", "POST", "{\"name\": \" Javascript_" . $name ."\", \"platform\": \"javascript\"}"); } + public static function getIssues($type){ + return json_decode(self::cURLRequest("https://sentry.io/api/0/projects/" .config('sentry.team_name'). "/" .$type. "_" .config('sentry.project_name'). "/issues/", "GET")); + } + public static function install($project){ $response = self::cURLRequest("https://sentry.io/api/0/projects/jesper-menting/".$project."/keys/", "GET"); $dsn = json_decode($response)[0]->dsn; @@ -58,10 +62,11 @@ private static function cURLRequest($url, $method, $field = null){ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => array( - "Authorization: Bearer 3a621cb7515e4b90881ebfb36a7231b31a0e7bf8454a41e59057e69ea8855884", + "Authorization: Bearer " . config('sentry.bearer_token'), "Cache-Control: no-cache", "Content-Type: application/json" - ),); + ), + ); if($field != null) $setopt_array[CURLOPT_POSTFIELDS] = $field; curl_setopt_array($curl, $setopt_array); @@ -71,4 +76,5 @@ private static function cURLRequest($url, $method, $field = null){ if ($err) return "cURL Error #:" . $err; return $response; } + } diff --git a/src/SentryServiceProvider.php b/src/SentryServiceProvider.php index 0687334..e2da2e2 100644 --- a/src/SentryServiceProvider.php +++ b/src/SentryServiceProvider.php @@ -13,7 +13,9 @@ class SentryServiceProvider extends ServiceProvider */ public function boot() { - + $this->publishes([ + __DIR__.'/config/sentry.php' => config_path('sentry.php'), + ], 'sentry-api'); } /** diff --git a/src/config/sentry.php b/src/config/sentry.php new file mode 100644 index 0000000..d559300 --- /dev/null +++ b/src/config/sentry.php @@ -0,0 +1,20 @@ + env('SENTRY_LARAVEL_DSN'), + + // capture release as git sha + // 'release' => trim(exec('git log --pretty="%h" -n1 HEAD')), + + // Capture bindings on SQL queries + 'breadcrumbs.sql_bindings' => true, + + // Capture default user context + 'user_context' => false, + + 'bearer_token' => '', + + 'project_name' => '', + 'team_name' => '', +); +