Add S3 Endpoint Support

This will offer support for other storage platforms that offer S3 like APIs such as
Backblaze B2, Wasabi, and DigitalOcean Spaces
This commit is contained in:
camjac251 2020-05-12 19:46:56 -05:00
parent 1d0f5b1527
commit 4dced7dd20
4 changed files with 10 additions and 1 deletions

View file

@ -54,6 +54,7 @@ return [
'secret' => $config['storage']['secret'],
],
'region' => $config['storage']['region'],
'endpoint' => $config['storage']['endpoint'],
'version' => 'latest',
'@http' => ['stream' => true],
]);

View file

@ -134,6 +134,7 @@ $app->post('/', function (Request $request, Response $response, \DI\Container $c
$config['storage']['key'] = param($request, 'storage_key');
$config['storage']['secret'] = param($request, 'storage_secret');
$config['storage']['region'] = param($request, 'storage_region');
$config['storage']['endpoint'] = param($request, 'storage_endpoint');
$config['storage']['bucket'] = param($request, 'storage_bucket');
$config['storage']['path'] = param($request, 'storage_path');
break;

View file

@ -71,7 +71,7 @@
<select id="storage_driver" name="storage_driver" class="form-control" required>
<option value="local">Local Storage</option>
<option value="ftp">FTP/FTPS</option>
<option value="s3">Amazon AWS S3</option>
<option value="s3">Amazon S3 (or compatible)</option>
<option value="google-cloud">Google Cloud Storage</option>
<option value="dropbox">Dropbox</option>
</select>
@ -101,6 +101,12 @@
<input type="text" class="form-control hook-storage-input" id="storage_region" name="storage_region" placeholder="your-region" autocomplete="off">
</div>
</div>
<div class="form-group row hook-storage">
<label for="storage_region" class="col-sm-3 col-form-label">AWS S3 endpoint</label>
<div class="col-sm-9">
<input type="text" class="form-control hook-storage-input" id="storage_endpoint" name="storage_endpoint" placeholder="optional (for S3-compliant services)" autocomplete="off">
</div>
</div>
<div class="form-group row hook-storage">
<label for="storage_token" class="col-sm-3 col-form-label">Dropbox token</label>
<div class="col-sm-9">

View file

@ -44,6 +44,7 @@ $(document).ready(function () {
$('#storage_key').prop('required', 'required').parent().parent().show();
$('#storage_secret').prop('required', 'required').parent().parent().show();
$('#storage_region').prop('required', 'required').parent().parent().show();
$("#storage_endpoint").prop('required', 'required').parent().parent().show();
$('#storage_bucket').prop('required', 'required').parent().parent().show();
break;
case 'google-cloud':