Better S3 backup generation support

This commit is contained in:
Dane Everitt 2020-05-03 20:49:09 -07:00
parent 3e04540c38
commit c4e9c0a4ba
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 3 additions and 3 deletions

View file

@ -3,11 +3,11 @@
namespace Pterodactyl\Extensions\Backups; namespace Pterodactyl\Extensions\Backups;
use Closure; use Closure;
use Aws\S3\S3Client;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use InvalidArgumentException; use InvalidArgumentException;
use Aws\S3\S3MultiRegionClient;
use League\Flysystem\AdapterInterface; use League\Flysystem\AdapterInterface;
use League\Flysystem\AwsS3v3\AwsS3Adapter; use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Memory\MemoryAdapter; use League\Flysystem\Memory\MemoryAdapter;
@ -160,7 +160,7 @@ class BackupManager
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
} }
$client = new S3MultiRegionClient($config); $client = new S3Client($config);
return new AwsS3Adapter($client, $config['bucket'], $config['prefix'] ?? '', $config['options'] ?? []); return new AwsS3Adapter($client, $config['bucket'], $config['prefix'] ?? '', $config['options'] ?? []);
} }

View file

@ -154,7 +154,7 @@ class InitiateBackupService
$client->getCommand('PutObject', [ $client->getCommand('PutObject', [
'Bucket' => $adapter->getBucket(), 'Bucket' => $adapter->getBucket(),
'Key' => $path, 'Key' => $path,
'ContentType' => 'binary/octet-stream', 'ContentType' => 'application/x-gzip',
]), ]),
CarbonImmutable::now()->addMinutes(30) CarbonImmutable::now()->addMinutes(30)
); );