Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
}
],
"require": {
"php-opencloud/common": "~1.0"
"php-opencloud/common": "^1.0.5"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"sami/sami": "dev-master",
"psr/log": "~1.0",
"satooshi/php-coveralls": "~1.0",
"jakub-onderka/php-parallel-lint": "0.*",
"fabpot/php-cs-fixer": "~1.0"
"friendsofphp/php-cs-fixer": "^1.0"
}
}
15 changes: 12 additions & 3 deletions src/OpenStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class OpenStack
private $builder;

/**
* @param array $options User-defined options
* @param array $options User-defined options
*
* $options['username'] = (string) Your OpenStack username [REQUIRED]
* ['password'] = (string) Your OpenStack password [REQUIRED]
Expand All @@ -30,6 +30,9 @@ class OpenStack
* ['debugLog'] = (bool) Whether to enable HTTP logging [OPTIONAL]
* ['logger'] = (LoggerInterface) Must set if debugLog is true [OPTIONAL]
* ['messageFormatter'] = (MessageFormatter) Must set if debugLog is true [OPTIONAL]
* ['requestOptions'] = (array) Guzzle Http request options [OPTIONAL]
*
* @param Builder $builder
*/
public function __construct(array $options = [], Builder $builder = null)
{
Expand All @@ -51,10 +54,16 @@ private function getDefaultIdentityService(array $options): Service
throw new \InvalidArgumentException("'authUrl' is a required option");
}

return Service::factory(new Client([
$clientOptions = [
'base_uri' => Utils::normalizeUrl($options['authUrl']),
'handler' => HandlerStack::create(),
]));
];

if (isset($options['requestOptions'])) {
$clientOptions = array_merge($options['requestOptions'], $clientOptions);
}

return Service::factory(new Client($clientOptions));
}

/**
Expand Down