Skip to content

Commit

Permalink
add --unsafe-ssl option, keep it safe by default (refs #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mborne committed Apr 7, 2023
1 parent 4ccfb8c commit acf89e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 6 additions & 5 deletions src/MBO/SatisGitlab/Command/GitlabToConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected function configure() {
*/
->addArgument('gitlab-url', InputArgument::REQUIRED)
->addArgument('gitlab-token')
->addOption('unsafe-ssl', null, InputOption::VALUE_NONE, 'allows to ignore SSL problems')

/*
* Project listing options (hosted git api level)
Expand Down Expand Up @@ -102,11 +103,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$clientOptions = new ClientOptions();
$clientOptions->setUrl($input->getArgument('gitlab-url'));
$clientOptions->setToken($input->getArgument('gitlab-token'));
/*
* TODO add option
* see https://github.com/mborne/satis-gitlab/issues/2
*/
$clientOptions->setUnsafeSsl(true);

if ( $input->getOption('unsafe-ssl') ){
$clientOptions->setUnsafeSsl(true);
}

$client = ClientFactory::createClient(
$clientOptions,
$logger
Expand Down
9 changes: 1 addition & 8 deletions tests/Command/expected-with-filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
},
{
"type": "vcs",
"url": "https:\/\/gitlab.com\/mborne\/sample-composer.git",
"options": {
"ssl": {
"verify_peer": false,
"verify_peer_name": false,
"allow_self_signed": true
}
}
"url": "https:\/\/gitlab.com\/mborne\/sample-composer.git"
}
],
"require": {
Expand Down

0 comments on commit acf89e5

Please sign in to comment.