Skip to content

Commit

Permalink
Merge pull request #83 from eivydas/fix-awss3-options
Browse files Browse the repository at this point in the history
Fix AWS S3 adapter options
  • Loading branch information
basz authored May 30, 2023
2 parents 6b2c9d6 + 0249227 commit 2eee1c5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
14 changes: 7 additions & 7 deletions config/bsb_flysystem.local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ return [
'factory' => BsbFlysystem\Adapter\Factory\FtpAdapterFactory::class,
'options' => [
'connectionOptions' => [
'host' => 'localhost',
'root' => '/var/www/html',
'username' => 'username',
'password' => '',
'host' => 'localhost',
'root' => '/var/www/html',
'username' => 'username',
'password' => '',
// 'port' => 21,
// 'ssl' => false,
// 'timeout' => 90,
Expand Down Expand Up @@ -146,7 +146,6 @@ return [
'secret' => 'xxxxx',
],
'region' => 'eu-west-1',
'bucket' => 'xxxxx',
'version' => 'latest', // default: 'latest'
// guzzle request options; see http://docs.guzzlephp.org/en/latest/request-options.html#proxy
'http' => [
Expand All @@ -156,13 +155,14 @@ return [
],
'bucket' => 'xxxxx',
// 'prefix' => '',
// 'visibility' => \League\Flysystem\Visibility::PUBLIC,
// 'mimeTypeDetector' => 'service_manager_key', // return a \League\MimeTypeDetection\MimeTypeDetector
// 'defaultVisibility' => \League\Flysystem\Visibility::PUBLIC,
// 'options' => [],
// 'streamReads' => true,
// 'forwardedOptions' => self::AVAILABLE_OPTIONS,
// 'metadataFields' => self::EXTRA_METADATA_FIELDS,
// 'multipartUploadOptions' => self::MUP_AVAILABLE_OPTIONS,
// 'iam' => false,
],
],
'replicate_default' => [
Expand Down Expand Up @@ -201,7 +201,7 @@ return [
],
],
],
'adapter_manager' => [
'adapter_manager' => [
'config' => [],
'lazy_services' => [
// directory where proxy classes will be written - default to system_get_tmp_dir()
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Factory/AwsS3v3AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public function doCreateService(ContainerInterface $container): FilesystemAdapte
$this->options['visibility'] = $container->get($this->options['visibility']);
}

unset($this->options['iam']);

return new AwsS3V3Adapter(...$this->options);
}

Expand Down
3 changes: 2 additions & 1 deletion test/Adapter/Factory/AwsS3v3AdapterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ public function testGettingFromServiceManager(): void
'client' => [
'credentials' => [
'key' => 'abc',
'secret' => 'xxx',
'secret' => 'xxx',
],
'region' => 'eu-west-1',
'version' => 'latest',
],
'bucket' => 'xxxxx',
'visibility' => 'a-visibility',
'mimeTypeDetector' => 'a-mime-type-detector',
'iam' => false,
]);

$this->assertInstanceOf(AwsS3V3Adapter::class, $adapter);
Expand Down
12 changes: 6 additions & 6 deletions test/Assets/bsb_flysystem.local.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
'factory' => BsbFlysystem\Adapter\Factory\FtpAdapterFactory::class,
'options' => [
'connectionOptions' => [
'host' => 'localhost',
'root' => '/var/www/html',
'username' => 'username',
'password' => '',
'host' => 'localhost',
'root' => '/var/www/html',
'username' => 'username',
'password' => '',
// 'port' => 21,
// 'ssl' => false,
// 'timeout' => 90,
Expand Down Expand Up @@ -161,7 +161,6 @@
'secret' => 'xxxxx',
],
'region' => 'eu-west-1',
'bucket' => 'xxxxx',
'version' => 'latest', // default: 'latest'
// guzzle request options; see http://docs.guzzlephp.org/en/latest/request-options.html#proxy
'http' => [
Expand All @@ -171,13 +170,14 @@
],
'bucket' => 'xxxxx',
// 'prefix' => '',
// 'visibility' => \League\Flysystem\Visibility::PUBLIC,
// 'mimeTypeDetector' => 'service_manager_key', // return a \League\MimeTypeDetection\MimeTypeDetector
// 'defaultVisibility' => \League\Flysystem\Visibility::PUBLIC,
// 'options' => [],
// 'streamReads' => true,
// 'forwardedOptions' => self::AVAILABLE_OPTIONS,
// 'metadataFields' => self::EXTRA_METADATA_FIELDS,
// 'multipartUploadOptions' => self::MUP_AVAILABLE_OPTIONS,
// 'iam' => false,
],
],
'replicate_default' => [
Expand Down

0 comments on commit 2eee1c5

Please sign in to comment.