Skip to content

Commit

Permalink
feat(apiurl) add option apiurl to change baseurl of SDK (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierozi authored Jul 30, 2019
1 parent c6bf9ff commit a17bc29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
}
],
"require": {
"continuousphp/sdk": "^0.8",
"symfony/console": "^3.3",
"hoa/console": "~3.0"
"continuousphp/sdk": "^0.9",
"symfony/console": "^3.3"
},
"autoload": {
"psr-4": {
Expand Down
13 changes: 10 additions & 3 deletions src/Command/CommandAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ protected function addTokenOption()
InputOption::VALUE_OPTIONAL,
'The profile of the configured credentials. See route configure',
null
)
->addOption(
'apiurl',
null,
InputOption::VALUE_OPTIONAL,
'The API URL (default https://api.continuousphp.com)',
null
);
}

Expand All @@ -78,9 +85,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$token = $input->getOption('token');
$profile = $input->getOption('profile');
$apiUrl = $input->getOption('apiurl') ?? null;

if (null === $token && false === ($token = getenv('CPHP_TOKEN'))) {

$profile = empty($profile) ? 'default' : $profile;
$token = ConfigureCommand::getToken($profile);

Expand All @@ -91,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$this->continuousClient = \Continuous\Sdk\Service::factory([
'token' => $token
]);
], $apiUrl);
}

protected function showLoader($output, $message = '', $max = 1)
Expand All @@ -117,4 +124,4 @@ protected function hideLoader($output)

$output->writeln("\n");
}
}
}

0 comments on commit a17bc29

Please sign in to comment.