Convert _APP_STORAGE_DEVICE env var to lowercase
This is done for backwards compatibility. Up to utopia-php/storage version 0.12.X, the devices were not lowercase. Starting 0.13.X, they are all converted to lowercase, but people would still have the old case in their .env file. This change makes the value check insensitive so that the value from older versions still works.
This commit is contained in:
parent
514b42bea2
commit
2b4dbfb4b9
6 changed files with 7 additions and 7 deletions
|
@ -482,9 +482,9 @@ return [
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => '_APP_STORAGE_DEVICE',
|
'name' => '_APP_STORAGE_DEVICE',
|
||||||
'description' => 'Select default storage device. The default value is \'Local\'. List of supported adapters are \'Local\', \'S3\', \'DOSpaces\', \'Backblaze\', \'Linode\' and \'Wasabi\'.',
|
'description' => 'Select default storage device. The default value is \'local\'. List of supported adapters are \'local\', \'s3\', \'dospaces\', \'backblaze\', \'linode\' and \'wasabi\'.',
|
||||||
'introduction' => '0.13.0',
|
'introduction' => '0.13.0',
|
||||||
'default' => 'Local',
|
'default' => 'local',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'question' => '',
|
'question' => '',
|
||||||
],
|
],
|
||||||
|
|
|
@ -501,7 +501,7 @@ App::post('/v1/storage/buckets/:bucketId/files')
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($chunksUploaded === $chunks) {
|
if ($chunksUploaded === $chunks) {
|
||||||
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antivirus', true) && $fileSize <= APP_LIMIT_ANTIVIRUS && App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL) === Storage::DEVICE_LOCAL) {
|
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antivirus', true) && $fileSize <= APP_LIMIT_ANTIVIRUS && strtolower(App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL)) === Storage::DEVICE_LOCAL) {
|
||||||
$antivirus = new Network(
|
$antivirus = new Network(
|
||||||
App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
|
App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
|
||||||
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)
|
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)
|
||||||
|
|
|
@ -119,7 +119,7 @@ function logError(Throwable $error, string $action, Utopia\Route $route = null)
|
||||||
|
|
||||||
function getStorageDevice($root): Device
|
function getStorageDevice($root): Device
|
||||||
{
|
{
|
||||||
switch (App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL)) {
|
switch (strtolower(App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL))) {
|
||||||
case Storage::DEVICE_LOCAL:
|
case Storage::DEVICE_LOCAL:
|
||||||
default:
|
default:
|
||||||
return new Local($root);
|
return new Local($root);
|
||||||
|
|
|
@ -968,7 +968,7 @@ App::setResource('deviceBuilds', function ($project) {
|
||||||
|
|
||||||
function getDevice($root): Device
|
function getDevice($root): Device
|
||||||
{
|
{
|
||||||
switch (App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL)) {
|
switch (strtolower(App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL))) {
|
||||||
case Storage::DEVICE_LOCAL:
|
case Storage::DEVICE_LOCAL:
|
||||||
default:
|
default:
|
||||||
return new Local($root);
|
return new Local($root);
|
||||||
|
|
|
@ -91,7 +91,7 @@ class BuildsV1 extends Worker
|
||||||
'outputPath' => '',
|
'outputPath' => '',
|
||||||
'runtime' => $function->getAttribute('runtime'),
|
'runtime' => $function->getAttribute('runtime'),
|
||||||
'source' => $deployment->getAttribute('path'),
|
'source' => $deployment->getAttribute('path'),
|
||||||
'sourceType' => App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL),
|
'sourceType' => strtolower(App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL)),
|
||||||
'stdout' => '',
|
'stdout' => '',
|
||||||
'stderr' => '',
|
'stderr' => '',
|
||||||
'endTime' => null,
|
'endTime' => null,
|
||||||
|
|
|
@ -284,7 +284,7 @@ abstract class Worker
|
||||||
*/
|
*/
|
||||||
public function getDevice($root): Device
|
public function getDevice($root): Device
|
||||||
{
|
{
|
||||||
switch (App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL)) {
|
switch (strtolower(App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL))) {
|
||||||
case Storage::DEVICE_LOCAL:
|
case Storage::DEVICE_LOCAL:
|
||||||
default:
|
default:
|
||||||
return new Local($root);
|
return new Local($root);
|
||||||
|
|
Loading…
Reference in a new issue