Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions classes/local/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public static function get_objectfs_config() {
$config->s3_region = 'us-east-1';
$config->s3_base_url = '';
$config->key_prefix = '';
$config->s3_use_path_style_endpoint = '0';


// Digital ocean file system.
$config->do_key = '';
Expand Down
9 changes: 9 additions & 0 deletions classes/local/store/s3/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ public function set_client($config) {
$options['endpoint'] = $config->s3_base_url;
}

if ($config->s3_use_path_style_endpoint) {
$options['use_path_style_endpoint'] = $config->s3_use_path_style_endpoint;
}

$this->client = \Aws\S3\S3Client::factory($options);
}

Expand Down Expand Up @@ -426,6 +430,11 @@ public function define_client_section($settings, $config) {
new \lang_string('settings:aws:key_prefix', 'tool_objectfs'),
new \lang_string('settings:aws:key_prefix_help', 'tool_objectfs'), ''));

$settings->add(new \admin_setting_configcheckbox('tool_objectfs/s3_use_path_style_endpoint',
new \lang_string('settings:aws:usepathstyle', 'tool_objectfs'),
new \lang_string('settings:aws:usepathstyle_help', 'tool_objectfs'),
'0'));

return $settings;
}

Expand Down
2 changes: 2 additions & 0 deletions lang/en/tool_objectfs.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
$string['settings:aws:sdkcredserror'] = 'Couldn\'t find AWS credentials. It\'s unsafe to enable this setting. Follow up <a href="https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html">AWS documentation</a>.';
$string['settings:aws:key_prefix'] = 'Prefix to use in bucket';
$string['settings:aws:key_prefix_help'] = 'Prefix to use inside Amazon S3 bucket. Must end with trailing slash when set. Leave blank to use root of bucket.';
$string['settings:aws:usepathstyle'] = 'Use path style endpoint';
$string['settings:aws:usepathstyle_help'] = 'Check to send requests to an S3 path style endpoint by default. Useful if S3 provider doesn\'t support access to bucket by subdomain.';

$string['settings:do:header'] = 'DigitalOcean Spaces Settings';
$string['settings:do:key'] = 'Key';
Expand Down