diff --git a/app/config/variables.php b/app/config/variables.php index b986ce4247..eced52d80a 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -711,13 +711,22 @@ return [ 'variables' => [ [ 'name' => '_APP_FUNCTIONS_SIZE_LIMIT', - 'description' => 'The maximum size deployment in bytes. The default value is 30MB.', + 'description' => 'The maximum size of a function in bytes. The default value is 30MB.', 'introduction' => '0.13.0', 'default' => '30000000', 'required' => false, 'question' => '', 'filter' => '' ], + [ + 'name' => '_APP_FUNCTIONS_BUILD_SIZE_LIMIT', + 'description' => 'The maximum size of a built deployment in bytes. The default value is 2,000,000,000 (2GB), and the maximum value is 4,294,967,295 (4.2GB).', + 'introduction' => '1.6.0', + 'default' => '2000000000', + 'required' => false, + 'question' => '', + 'filter' => '' + ], [ 'name' => '_APP_FUNCTIONS_TIMEOUT', 'description' => 'The maximum number of seconds allowed as a timeout value when creating a new function. The default value is 900 seconds. This is the global limit, timeout for individual functions are configured in the function\'s settings or in appwrite.json.', diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php index d026a9e54b..d0fb597258 100644 --- a/src/Appwrite/Platform/Workers/Builds.php +++ b/src/Appwrite/Platform/Workers/Builds.php @@ -493,6 +493,11 @@ class Builds extends Action $endTime = DateTime::now(); $durationEnd = \microtime(true); + $buildSizeLimit = (int) System::getEnv('_APP_FUNCTIONS_BUILD_SIZE_LIMIT', '2000000000'); + if ($response['size'] > $buildSizeLimit) { + throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / 1048576, 2) . ' MBs.'); + } + /** Update the build document */ $build->setAttribute('startTime', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime'])))); $build->setAttribute('endTime', $endTime); diff --git a/src/Appwrite/Utopia/Response/Model/TemplateFunction.php b/src/Appwrite/Utopia/Response/Model/TemplateFunction.php index 7a3a4cfbd5..f5df10986f 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateFunction.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateFunction.php @@ -110,8 +110,7 @@ class TemplateFunction extends Model 'default' => [], 'example' => [], 'array' => true - ]) - ; + ]); } /** diff --git a/src/Appwrite/Utopia/Response/Model/TemplateRuntime.php b/src/Appwrite/Utopia/Response/Model/TemplateRuntime.php index c08ea9b32a..c98a59789d 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateRuntime.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateRuntime.php @@ -33,8 +33,7 @@ class TemplateRuntime extends Model 'description' => 'Path to function in VCS (Version Control System) repository', 'default' => '', 'example' => 'node/starter', - ]) - ; + ]); } /** diff --git a/src/Appwrite/Utopia/Response/Model/TemplateVariable.php b/src/Appwrite/Utopia/Response/Model/TemplateVariable.php index b0fd919dbf..c992083a87 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateVariable.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateVariable.php @@ -10,37 +10,42 @@ class TemplateVariable extends Model public function __construct() { $this - ->addRule('name', [ - 'type' => self::TYPE_STRING, - 'description' => 'Variable Name.', - 'default' => '', - 'example' => 'APPWRITE_DATABASE_ID', - ]) - ->addRule('description', [ - 'type' => self::TYPE_STRING, - 'description' => 'Variable Description.', - 'default' => '', - 'example' => 'The ID of the Appwrite database that contains the collection to sync.', - ]) - ->addRule('placeholder', [ - 'type' => self::TYPE_STRING, - 'description' => 'Variable Placeholder.', - 'default' => '', - 'example' => '64a55...7b912', - ]) - ->addRule('required', [ - 'type' => self::TYPE_BOOLEAN, - 'description' => 'Is the variable required?', - 'default' => false, - 'example' => false, - ]) - ->addRule('type', [ - 'type' => self::TYPE_STRING, - 'description' => 'Variable Type.', - 'default' => '', - 'example' => 'password', - ]) - ; + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Name.', + 'default' => '', + 'example' => 'APPWRITE_DATABASE_ID', + ]) + ->addRule('description', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Description.', + 'default' => '', + 'example' => 'The ID of the Appwrite database that contains the collection to sync.', + ]) + ->addRule('value', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Value.', + 'default' => '', + 'example' => '512', + ]) + ->addRule('placeholder', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Placeholder.', + 'default' => '', + 'example' => '64a55...7b912', + ]) + ->addRule('required', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Is the variable required?', + 'default' => false, + 'example' => false, + ]) + ->addRule('type', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Type.', + 'default' => '', + 'example' => 'password', + ]); } /**