Skip to content

Commit

Permalink
Merge branch 'main' into ssh-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
A5hleyRich committed Dec 3, 2021
2 parents fe6ce6a + 70f3bbf commit 8c19375
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions app/Commands/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,16 @@ public function handle(): int

try {
if (!$this->spinupwp->hasApiKey()) {
$this->spinupwp->setApiKey($this->apiToken())->setClient();
}

// Allow to use a different API URL
if (!empty($this->config->get('api_url', $this->profile()))) {
$this->spinupwp->setClient(
new Client([
'base_uri' => $this->config->get('api_url', $this->profile()),
'http_errors' => false,
'headers' => [
'Authorization' => "Bearer {$this->config->get('api_token', $this->profile())}",
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
])
);
$this->spinupwp->setClient(new Client([
'base_uri' => $this->config->get('api_url', $this->profile(), 'https://api.spinupwp.app/v1/'),
'http_errors' => false,
'headers' => [
'Authorization' => "Bearer {$this->apiToken()}",
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'User-Agent' => 'SpinupWP/' . config('app.version'),
],
]));
}

return $this->action();
Expand Down

0 comments on commit 8c19375

Please sign in to comment.