Skip to content

Commit

Permalink
Always set user agent to Forge CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
olivernybroe committed Sep 30, 2024
1 parent fdf6b23 commit 0221eed
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions app/Repositories/ForgeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,16 @@ protected function ensureApiToken()

abort_if($token == null, 1, 'Please authenticate using the \'login\' command before proceeding.');

$guzzle = isset($_SERVER['FORGE_API_BASE'])
? new GuzzleHttp\Client([ // http://forge.test/api/v1/
'base_uri' => $_SERVER['FORGE_API_BASE'], // 'https://forge.laravel.com/api/v1/',
'http_errors' => false,
'headers' => [
'Authorization' => 'Bearer '.$token,
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'User-Agent' => 'Laravel Forge CLI/v'.config('app.version'),
],
]) : null;
$guzzle = new GuzzleHttp\Client([
'base_uri' => isset($_SERVER['FORGE_API_BASE']) ? $_SERVER['FORGE_API_BASE'] : 'https://forge.laravel.com/api/v1/',
'http_errors' => false,
'headers' => [
'Authorization' => 'Bearer '.$token,
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'User-Agent' => 'Laravel Forge CLI/v'.config('app.version'),
],
]);

$this->client->setApiKey($token, $guzzle);
}
Expand Down

0 comments on commit 0221eed

Please sign in to comment.