-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: presigned configured urls #2878
Conversation
src/AwsClient.php
Outdated
@@ -564,7 +564,11 @@ private function setClientBuiltIns($args) | |||
$config = $this->getConfig(); | |||
$service = $args['service']; | |||
|
|||
$builtIns['SDK::Endpoint'] = isset($args['endpoint']) ? $args['endpoint'] : null; | |||
$builtIns['SDK::Endpoint'] = isset($args['endpoint']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think readability can be improved here by using if statements instead. For example:
$builtIns['SDK::Endpoint'] = null;
if (isset($args['endpoint'])) {
$builtIns['SDK::Endpoint'] = $args['endpoint'];
} else if(isset($config['configured_endpoint_url'])) {
$builtIns['SDK::Endpoint'] = $this->getEndpoint();
}
Or if our docs build process would permit us:
$builtIns['SDK::Endpoint'] = args['endpoint'] ?? $config['configured_endpoint_url'] ?? null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why should we not consider the endpoint resolved by the ClientResolver utility instead?
For example, the client resolver will ignore resolving an endpoint if it was already provided in the arguments, otherwise it will resolve the endpoint with the default implementation there.
So then the resolved config should contains the endpoint we need:
Line 226 in b4d98bf
$this->endpoint = new Uri($config['endpoint']); |
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're unable to do that for historical reasons. The legacy endpoint provider will add an endpoint to the args returned from the clientResolver if that value is not already set, meaning the value is always set and we need a way to determine whether or not a customer has resolved an endpoint from their environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: the readability, happy to change that to an if/else.
Description of changes:
Fixes issue with configured endpoint urls when used during presigning.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.