diff --git a/README.md b/README.md index 010c6bf..68cf090 100644 --- a/README.md +++ b/README.md @@ -39,12 +39,14 @@ We will also add support for easier integration with your models, by adding a S3 'defaultBucket' => 'my-bucket', 'defaultAcl' => 'public-read', 'defaultPresignedExpiration' => '+1 hour', + 'endpoint' => 'http://localhost:9000', ], // ... ], ``` **Credentials parameter is optional**: if you plan to use IAM roles attached to your EC2 instance there is no need for credentials. Just remove this parameter. Just be cautious if you need those credentials, this may cause errors during execution. +**Endpoint parameter is optional**: You can specify a custom endpoint here. Great for debugging with minio for example. ## Basic usage diff --git a/src/Service.php b/src/Service.php index 2bb6c21..c76c9e7 100644 --- a/src/Service.php +++ b/src/Service.php @@ -24,6 +24,7 @@ * @method bool exist(string $filename) * @method string getUrl(string $filename) * @method string getPresignedUrl(string $filename, $expires) + * @property string $endpoint * * @package bpsys\yii2\aws\s3 */ @@ -159,6 +160,15 @@ public function setHttpOptions(array $options) $this->clientConfig['http'] = $options; } + /** + * @param string $endpoint + */ + public function setEndpoint(string $endpoint) + { + $this->clientConfig['endpoint'] = $endpoint; + $this->clientConfig['use_path_style_endpoint'] = true; + } + /** * @param string|array|object $resolver */