Commit 1e4398ec authored by Elias Luhr's avatar Elias Luhr

Make s3 fs toggable

parent 63145bbf
Pipeline #81882 passed with stage
in 3 minutes and 51 seconds
......@@ -124,8 +124,10 @@ SQL;
return $event;
});
$s3Enabled = class_exists('League\Flysystem\AwsS3v3\AwsS3Adapter') && getenv('AMAZON_S3_BUCKET_PUBLIC_KEY') && getenv('AMAZON_S3_BUCKET_SECRET_KEY') && getenv('AMAZON_S3_BUCKET_NAME') && getenv('AMAZON_S3_BUCKET_REGION');
// Basic configuration, used in web and console applications
return [
$common = [
'id' => 'app',
'name' => getenv('APP_TITLE'),
'language' => $languages[0],
......@@ -258,14 +260,6 @@ return [
'class' => LocalFilesystem::class,
'path' => '@storage'
],
'fsS3' => [
'class' => AwsS3Filesystem::class,
'key' => getenv('AMAZON_S3_BUCKET_PUBLIC_KEY'),
'secret' => getenv('AMAZON_S3_BUCKET_SECRET_KEY'),
'bucket' => getenv('AMAZON_S3_BUCKET_NAME'),
'prefix' => getenv('APP_NAME') . '/public',
'region' => getenv('AMAZON_S3_BUCKET_REGION')
],
'fsRuntime' => [
'class' => LocalFilesystem::class,
'path' => '@runtime'
......@@ -474,7 +468,6 @@ return [
'layout' => $boxLayout,
'filesystem' => getenv('APP_FILEFLY_DEFAULT_FILESYSTEM'),
'filesystemComponents' => [
's3' => 'fsS3',
'local' => 'fsLocal',
'runtime' => 'fsRuntime'
]
......@@ -564,3 +557,18 @@ return [
]
]
];
if ($s3Enabled) {
$common['components']['fsS3'] = [
'class' => AwsS3Filesystem::class,
'key' => getenv('AMAZON_S3_BUCKET_PUBLIC_KEY'),
'secret' => getenv('AMAZON_S3_BUCKET_SECRET_KEY'),
'bucket' => getenv('AMAZON_S3_BUCKET_NAME'),
'prefix' => getenv('APP_NAME') . '/public',
'region' => getenv('AMAZON_S3_BUCKET_REGION')
];
$common['modules']['filefly']['filesystemComponents']['s3'] = 'fsS3';
}
return $common;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment