A simple FastAPI service that provides public access to files stored in private S3-compatible storage. Designed for MediaWiki instances using Extension:AWS where the S3 bucket is only accessible within a VPN or private network.
Set these environment variables before running the service:
S3_ACCESS_KEY_ID="your_access_key"
S3_SECRET_ACCESS_KEY="your_secret_key"
S3_REGION="eu-central-1"
S3_BUCKET_NAME="your-bucket-name"
S3_ENDPOINT="https://your-s3-endpoint.com"Add this configuration to LocalSettings.php:
wfLoadExtension( 'AWS' );
$wgAWSCredentials = [
'key' => getenv('S3_ACCESS_KEY_ID'),
'secret' => getenv('S3_SECRET_ACCESS_KEY'),
'token' => false
];
$s3endpoint = getenv('S3_ENDPOINT');
$wgAWSRegion = getenv('S3_REGION')
$wgAWSBucketName = getenv('S3_BUCKET_NAME')
$wgAWSBucketDomain = 'files.yourdomain.com';For further details on configuring the AWS extension on Mediawiki, see the documentation for the AWS extension.