feat: review comments
This commit is contained in:
parent
ad5bd3b328
commit
4271e34b39
4 changed files with 24 additions and 45 deletions
|
@ -494,7 +494,17 @@ 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) { // TODO : fetch from DSN
|
|
||||||
|
$connection = App::getEnv('_APP_CONNECTIONS_STORAGE', '');
|
||||||
|
$device = STORAGE_DEVICE_LOCAL;
|
||||||
|
try {
|
||||||
|
$dsn = new DSN($connection);
|
||||||
|
$device = $dsn->getScheme();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$device = STORAGE_DEVICE_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antivirus', true) && $fileSize <= APP_LIMIT_ANTIVIRUS && $device === 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)
|
||||||
|
|
|
@ -1123,7 +1123,7 @@ function getDevice($root): Device
|
||||||
$bucket = $dsn->getPath();
|
$bucket = $dsn->getPath();
|
||||||
$region = $dsn->getParam('region');
|
$region = $dsn->getParam('region');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Console::error($e->getMessage() . 'Invalid DSN. Defaulting to Local storage.');
|
Console::eor($e->getMessage() . 'Invalid DSN. Defaulting to Local storage.');
|
||||||
$device = STORAGE_DEVICE_LOCAL;
|
$device = STORAGE_DEVICE_LOCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,27 +120,7 @@ services:
|
||||||
- _APP_STORAGE_ANTIVIRUS
|
- _APP_STORAGE_ANTIVIRUS
|
||||||
- _APP_STORAGE_ANTIVIRUS_HOST
|
- _APP_STORAGE_ANTIVIRUS_HOST
|
||||||
- _APP_STORAGE_ANTIVIRUS_PORT
|
- _APP_STORAGE_ANTIVIRUS_PORT
|
||||||
- _APP_STORAGE_DEVICE
|
- _APP_CONNECTIONS_STORAGE
|
||||||
- _APP_STORAGE_S3_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_S3_SECRET
|
|
||||||
- _APP_STORAGE_S3_REGION
|
|
||||||
- _APP_STORAGE_S3_BUCKET
|
|
||||||
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_DO_SPACES_SECRET
|
|
||||||
- _APP_STORAGE_DO_SPACES_REGION
|
|
||||||
- _APP_STORAGE_DO_SPACES_BUCKET
|
|
||||||
- _APP_STORAGE_BACKBLAZE_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_BACKBLAZE_SECRET
|
|
||||||
- _APP_STORAGE_BACKBLAZE_REGION
|
|
||||||
- _APP_STORAGE_BACKBLAZE_BUCKET
|
|
||||||
- _APP_STORAGE_LINODE_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_LINODE_SECRET
|
|
||||||
- _APP_STORAGE_LINODE_REGION
|
|
||||||
- _APP_STORAGE_LINODE_BUCKET
|
|
||||||
- _APP_STORAGE_WASABI_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_WASABI_SECRET
|
|
||||||
- _APP_STORAGE_WASABI_REGION
|
|
||||||
- _APP_STORAGE_WASABI_BUCKET
|
|
||||||
- _APP_FUNCTIONS_SIZE_LIMIT
|
- _APP_FUNCTIONS_SIZE_LIMIT
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
- _APP_FUNCTIONS_TIMEOUT
|
||||||
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
|
@ -284,27 +264,7 @@ services:
|
||||||
- _APP_REDIS_PORT
|
- _APP_REDIS_PORT
|
||||||
- _APP_REDIS_USER
|
- _APP_REDIS_USER
|
||||||
- _APP_REDIS_PASS
|
- _APP_REDIS_PASS
|
||||||
- _APP_STORAGE_DEVICE
|
- _APP_CONNECTIONS_STORAGE
|
||||||
- _APP_STORAGE_S3_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_S3_SECRET
|
|
||||||
- _APP_STORAGE_S3_REGION
|
|
||||||
- _APP_STORAGE_S3_BUCKET
|
|
||||||
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_DO_SPACES_SECRET
|
|
||||||
- _APP_STORAGE_DO_SPACES_REGION
|
|
||||||
- _APP_STORAGE_DO_SPACES_BUCKET
|
|
||||||
- _APP_STORAGE_BACKBLAZE_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_BACKBLAZE_SECRET
|
|
||||||
- _APP_STORAGE_BACKBLAZE_REGION
|
|
||||||
- _APP_STORAGE_BACKBLAZE_BUCKET
|
|
||||||
- _APP_STORAGE_LINODE_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_LINODE_SECRET
|
|
||||||
- _APP_STORAGE_LINODE_REGION
|
|
||||||
- _APP_STORAGE_LINODE_BUCKET
|
|
||||||
- _APP_STORAGE_WASABI_ACCESS_KEY
|
|
||||||
- _APP_STORAGE_WASABI_SECRET
|
|
||||||
- _APP_STORAGE_WASABI_REGION
|
|
||||||
- _APP_STORAGE_WASABI_BUCKET
|
|
||||||
- _APP_LOGGING_PROVIDER
|
- _APP_LOGGING_PROVIDER
|
||||||
- _APP_LOGGING_CONFIG
|
- _APP_LOGGING_CONFIG
|
||||||
- _APP_EXECUTOR_SECRET
|
- _APP_EXECUTOR_SECRET
|
||||||
|
|
|
@ -79,6 +79,15 @@ class BuildsV1 extends Worker
|
||||||
throw new Exception('Runtime "' . $function->getAttribute('runtime', '') . '" is not supported');
|
throw new Exception('Runtime "' . $function->getAttribute('runtime', '') . '" is not supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$connection = App::getEnv('_APP_CONNECTIONS_STORAGE', '');
|
||||||
|
$device = STORAGE_DEVICE_LOCAL;
|
||||||
|
try {
|
||||||
|
$dsn = new DSN($connection);
|
||||||
|
$device = $dsn->getScheme();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$device = STORAGE_DEVICE_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
$buildId = $deployment->getAttribute('buildId', '');
|
$buildId = $deployment->getAttribute('buildId', '');
|
||||||
$startTime = DateTime::now();
|
$startTime = DateTime::now();
|
||||||
if (empty($buildId)) {
|
if (empty($buildId)) {
|
||||||
|
@ -92,7 +101,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), // TODO : fetch from DSN
|
'sourceType' => $device,
|
||||||
'stdout' => '',
|
'stdout' => '',
|
||||||
'stderr' => '',
|
'stderr' => '',
|
||||||
'endTime' => null,
|
'endTime' => null,
|
||||||
|
|
Loading…
Reference in a new issue