Skip to content

Commit

Permalink
Merge branch 'non-interactive-api-whitelist' into 'master'
Browse files Browse the repository at this point in the history
Fix api whitelisting when using non-interactive mode

See merge request transip/restapi-cli-client!183
  • Loading branch information
svenwiltink committed Nov 22, 2023
2 parents 332734f + debed8a commit 3b90681
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CHANGELOG
=========
6.33.3
-----
* Correctly parse the useApiWhitelist flag when using non interactive mode

6.33.2
-----
Expand Down
8 changes: 5 additions & 3 deletions src/Command/Setup/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
$input->setOption(Field::API_LOGIN, $login);

// Third question: use the IP whitelist?
$apiUseWhitelist = $input->getOption(Field::API_USE_WHITELIST);
$apiUseWhitelistString = $input->getOption(Field::API_USE_WHITELIST);
$apiUseWhitelist = filter_var($apiUseWhitelistString, FILTER_VALIDATE_BOOLEAN);

$whitelistQuestion = new ConfirmationQuestion(
"Use IP Whitelisting? [<comment>Yes</comment>]: ",
"Use IP Whitelisting? [<comment>{$apiUseWhitelistString}</comment>]: ",
$apiUseWhitelist
);

Expand Down Expand Up @@ -84,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$apiUrl = strval($input->getOption(Field::API_URL));
$login = strval($input->getOption(Field::API_LOGIN));
$whitelist = boolval($input->getOption(Field::API_USE_WHITELIST));
$whitelist = filter_var($input->getOption(Field::API_USE_WHITELIST), FILTER_VALIDATE_BOOLEAN);
$privateKey = $input->getOption(Field::API_PRIVATE_KEY);

if (strlen($privateKey) < 2) {
Expand Down
2 changes: 1 addition & 1 deletion src/Settings/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Settings

public const TRANSIP_API_ENDPOINT = 'https://api.transip.nl/v6';

public const TRANSIP_CLI_VERSION = '6.33.2';
public const TRANSIP_CLI_VERSION = '6.33.3';

/**
* @var string
Expand Down

0 comments on commit 3b90681

Please sign in to comment.