Merge branch '1.6.x' into feat-add-multipart-support

This commit is contained in:
Khushboo Verma
2024-08-12 15:39:46 +05:30
10 changed files with 112 additions and 9 deletions
+14
View File
@@ -2,6 +2,7 @@
namespace Appwrite\Platform\Workers;
use Ahc\Jwt\JWT;
use Appwrite\Event\Event;
use Appwrite\Event\Func;
use Appwrite\Event\Usage;
@@ -393,8 +394,21 @@ class Builds extends Action
$vars[$var->getAttribute('key')] = $var->getAttribute('value', '');
}
$jwtExpiry = (int) System::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900);
$jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $jwtExpiry, 0);
$apiKey = $jwtObj->encode([
'projectId' => $project->getId(),
'scopes' => $function->getAttribute('scopes', [])
]);
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
$hostname = System::getEnv('_APP_DOMAIN');
$endpoint = $protocol . '://' . $hostname . "/v1";
// Appwrite vars
$vars = \array_merge($vars, [
'APPWRITE_FUNCTION_API_ENDPOINT' => $endpoint,
'APPWRITE_FUNCTION_API_KEY' => API_KEY_DYNAMIC . '_' . $apiKey,
'APPWRITE_FUNCTION_ID' => $function->getId(),
'APPWRITE_FUNCTION_NAME' => $function->getAttribute('name'),
'APPWRITE_FUNCTION_DEPLOYMENT' => $deployment->getId(),
+1 -1
View File
@@ -494,7 +494,7 @@ class Functions extends Action
logging: $function->getAttribute('logging', true),
);
$status = $executionResponse['statusCode'] >= 400 ? 'failed' : 'completed';
$status = $executionResponse['statusCode'] >= 500 ? 'failed' : 'completed';
$headersFiltered = [];
foreach ($executionResponse['headers'] as $key => $value) {
@@ -24,6 +24,12 @@ class V18 extends Filter
protected function parseExecution(array $content)
{
if(!empty($content['status']) && !empty($content['statusCode'])) {
if($content['status'] === 'completed' && $content['statusCode'] >= 400 && $content['statusCode'] < 500) {
$content['status'] = 'failed';
}
}
unset($content['scheduledAt']);
return $content;
}
@@ -16,6 +16,12 @@ class Runtime extends Model
'default' => '',
'example' => 'python-3.8',
])
->addRule('key', [
'type' => self::TYPE_STRING,
'description' => 'Parent runtime key.',
'default' => '',
'example' => 'python',
])
->addRule('name', [
'type' => self::TYPE_STRING,
'description' => 'Runtime Name.',