Skip to content

Commit

Permalink
Merge pull request #1 from DBX12/add-endpoint-config
Browse files Browse the repository at this point in the history
Add endpoint as configuration option
  • Loading branch information
bpanatta authored Aug 21, 2022
2 parents 6a6c887 + 8140073 commit ca88a61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit ca88a61

Please sign in to comment.