edwardspec / mediawiki-aws-s3

Extension:AWS allows MediaWiki to use Amazon S3 (instead of the local directory) to store images.
https://www.mediawiki.org/wiki/Extension:AWS
GNU General Public License v2.0
42 stars 32 forks source link

Added support for path style endpoints #58

Closed yoshz closed 1 year ago

yoshz commented 1 year ago

In case users use a non AWS S3 storage backend that doesn't support bucket domains you wan't to enable the option use_path_style_endpoint on the S3Client. In this PR I have added support to pass this on to the S3Client.

I have also enabled support of added the scheme to $wgAWSBucketDomain so the extension also work on testing environments where HTTPS is not set up.

With the following configuration it is now possible to use this extension with Minio (#46):

wfLoadExtension( 'AWS' );
$wgAWSCredentials = [
    'key' => 'minioadmin',
    'secret' => 'minioadmin',
    'token' => false
];
$wgAWSRegion = 'dev';
$wgAWSBucketName = 'images';
$wgAWSBucketDomain = 'http://localhost:9000/$1';
$wgFileBackends['s3']['endpoint'] = 'http://localhost:9000';
$wgFileBackends['s3']['use_path_style_endpoint'] = true;
edwardspec commented 1 year ago

Thank you for your contribution.

I will merge this PR after I resolve an unrelated issue that caused the automated test to fail (errors during installation of the Moto server, which is used by the tests).

edwardspec commented 1 year ago

Merged into master.