Skip to content

Commit a17bc29

Browse files
authored
feat(apiurl) add option apiurl to change baseurl of SDK (#19)
1 parent c6bf9ff commit a17bc29

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
}
1111
],
1212
"require": {
13-
"continuousphp/sdk": "^0.8",
14-
"symfony/console": "^3.3",
15-
"hoa/console": "~3.0"
13+
"continuousphp/sdk": "^0.9",
14+
"symfony/console": "^3.3"
1615
},
1716
"autoload": {
1817
"psr-4": {

src/Command/CommandAbstract.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ protected function addTokenOption()
6767
InputOption::VALUE_OPTIONAL,
6868
'The profile of the configured credentials. See route configure',
6969
null
70+
)
71+
->addOption(
72+
'apiurl',
73+
null,
74+
InputOption::VALUE_OPTIONAL,
75+
'The API URL (default https://api.continuousphp.com)',
76+
null
7077
);
7178
}
7279

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

8290
if (null === $token && false === ($token = getenv('CPHP_TOKEN'))) {
83-
8491
$profile = empty($profile) ? 'default' : $profile;
8592
$token = ConfigureCommand::getToken($profile);
8693

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

9299
$this->continuousClient = \Continuous\Sdk\Service::factory([
93100
'token' => $token
94-
]);
101+
], $apiUrl);
95102
}
96103

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

118125
$output->writeln("\n");
119126
}
120-
}
127+
}

0 commit comments

Comments
 (0)