Skip to content

Commit eb511f9

Browse files
authored
Enhances AWS extension auto-configuration with private mode support (#510)
1 parent 3e48d13 commit eb511f9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

_sources/canasta/CanastaDefaultSettings.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
$wgCdnServersNoPurge[] = '192.168.0.0/16'; // 192.168.0.0 – 192.168.255.255
7272

7373
# Auto-configuration for AWS extension QLOUD-122
74+
# Note: we usually don't have auto-configuration here, but there is no better place for this on Canasta
7475
if ( !empty( getenv( 'AWS_IMAGES_BUCKET' ) ) ) {
7576
// see https://github.com/edwardspec/mediawiki-aws-s3
7677
wfLoadExtension( 'AWS' );
@@ -91,6 +92,12 @@
9192
// for images to work in private mode, $wgUploadPath should point to img_auth.php
9293
if ( !empty( getenv( 'AWS_IMAGES_PRIVATE' ) ) ) {
9394
$wgFileBackends['s3']['privateWiki'] = true;
95+
// When private mode is enabled we MUST revok read right from anonymous users
96+
// and MUST configure img_auth.php setting, see QLOUD-124
97+
// NOTE: any possible overrides of these settings in any of the subsequently
98+
// loaded configs (config/settings/*.php) must be REMOVED
99+
$wgGroupPermissions['*']['read'] = false;
100+
$wgUploadPath = "$wgScriptPath/img_auth.php";
94101
}
95102
if ( !empty( getenv( 'AWS_IMAGES_ENDPOINT' ) ) ) {
96103
$wgFileBackends['s3']['endpoint'] = getenv( 'AWS_IMAGES_ENDPOINT' );

0 commit comments

Comments
 (0)