Closed mngreece closed 5 years ago
You should be able to do this by specifying an options variable in your yaml config for the public adapter defining the base_url https://flysystem.thephpleague.com/docs/adapter/aws-s3/
Would be something like
SilverStripe\S3\Adapter\PublicAdapter:
constructor:
s3Client: '%$Aws\S3\S3Client'
bucket: '`AWS_BUCKET_NAME`'
prefix: '`AWS_PUBLIC_BUCKET_PREFIX`'
options:
- base_url: 'https://....'
You could also extend the PublicAdapter class and change the getUrl function I believe
I've extended the PublicAdapter but will try out the config option above - thanks.
@obj63mc
Could you double check that please? I've tried many variations but the base_url is never used despite evidently being passed through to the options parameter
For anyone who stumbles on this, I found this worked:
SilverStripe\Core\Injector\Injector:
Aws\S3\S3Client:
constructor:
configuration:
endpoint: https://s3.{region}.{host}.com
Where host is amazonaws, or wasabisys, etc.
Support for having a CloudFront distribution that has a s3 bucket for assets behind the distribution and only requests for public assets and can only be accessed from CloudFront, i.e. https://some-domain.com/assets/
At the moment public the URL returned is always https://.s3...amazonaws.com/xxxxx