Skip to content

Commit

Permalink
Merge pull request #36 from mborne/2-unsafe-ssl
Browse files Browse the repository at this point in the history
Add option --unsafe-ssl
  • Loading branch information
mborne authored Apr 7, 2023
2 parents 4ccfb8c + a81aa51 commit ac3a3db
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
19 changes: 19 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Notes about some options

## unsafe-ssl

Using `--unsafe-ssl` produce the following output for repositories :

```json
{
"options": {
"ssl": {
"allow_self_signed": true,
"verify_peer": false,
"verify_peer_name": false
}
},
"type": "vcs",
"url": "https://gitlab.com/mborne/sample-composer.git"
}
```
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 ac3a3db

Please sign in to comment.