transip / tipctl

The command line interface for the TransIP API
https://api.transip.nl/rest/docs.html
Apache License 2.0
16 stars 4 forks source link

[Feature request] add the possibility to specify a specific cli-config.json file in a CLI command #4

Closed Broekman closed 3 years ago

Broekman commented 3 years ago

[Feature request] add the possibility to specify a specific cli-config.json file within a specific CLI command.

Currently it's limited to a hard-coded $HOME_DIR$/.config/transip-api/cli-config.json. If I e.g. have to switch accounts I would have to run setup again.

Would also be fine to use the tipctl setup --no-interaction --apiUrl 'https://api.transip.nl/v6' --loginName 'yourUsername' --apiPrivateKey 'yourKeyPair' --apiUseWhitelist true however I keep getting a runtime exception saying the provided RestAPI key is invalid (setup.php line 89). How do I have to input the private key here? Tried multiple options.

setup.php:89

$privateKey = '';

// multiline input hack
for ($i = 0; $i < 30; $i++) {
    $privateKeyPart = $helper->ask($input, $output, $keyQuestion);
    $privateKey     .= $privateKeyPart . PHP_EOL;

    if (strpos($privateKeyPart, '-----END PRIVATE KEY-----') !== false || $privateKeyPart == '') {
        break;
    }
}

if (strlen($privateKey) < 2) {
    throw new RuntimeException('Provided RestAPI key is invalid');
}

Thanks!

Broekman commented 3 years ago

No response so closing.