Skip to content
This repository has been archived by the owner on Feb 15, 2021. It is now read-only.

Commit

Permalink
Added config file & added function to get issues from sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
jjwmenting committed May 29, 2018
1 parent 191c1e8 commit 604f79d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/SentryAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -71,4 +76,5 @@ private static function cURLRequest($url, $method, $field = null){
if ($err) return "cURL Error #:" . $err;
return $response;
}

}
4 changes: 3 additions & 1 deletion src/SentryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class SentryServiceProvider extends ServiceProvider
*/
public function boot()
{

$this->publishes([
__DIR__.'/config/sentry.php' => config_path('sentry.php'),
], 'sentry-api');
}

/**
Expand Down
20 changes: 20 additions & 0 deletions src/config/sentry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

return array(
'dsn' => 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' => '',
);

0 comments on commit 604f79d

Please sign in to comment.