Renamed env param on /v1/functions to runtime

This commit is contained in:
Bradley Schofield
2021-06-21 15:42:39 +01:00
parent a433181e17
commit c92a820c6d
4 changed files with 12 additions and 9 deletions
+3
View File
@@ -10,6 +10,9 @@
- Add Anonymous Account Placeholder
- Upgraded telegraf docker image version to v1.1.0
## Breaking Changes (Read before upgrading!)
- Renamed `env` param on `/v1/functions` to `runtime`
## Bugs
- Fixed bug when removing a project member on the Appwrite console (#1214)
+3 -3
View File
@@ -39,14 +39,14 @@ App::post('/v1/functions')
->label('sdk.response.model', Response::MODEL_FUNCTION)
->param('name', '', new Text(128), 'Function name. Max length: 128 chars.')
->param('execute', [], new ArrayList(new Text(64)), 'An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('env', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution enviornment.')
->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution enviornment.')
->param('vars', [], new Assoc(), 'Key-value JSON object.', true)
->param('events', [], new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)), 'Events list.', true)
->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true)
->param('timeout', 15, new Range(1, 900), 'Function maximum execution time in seconds.', true)
->inject('response')
->inject('projectDB')
->action(function ($name, $execute, $env, $vars, $events, $schedule, $timeout, $response, $projectDB) {
->action(function ($name, $execute, $runtime, $vars, $events, $schedule, $timeout, $response, $projectDB) {
/** @var Appwrite\Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */
@@ -59,7 +59,7 @@ App::post('/v1/functions')
'dateUpdated' => time(),
'status' => 'disabled',
'name' => $name,
'env' => $env,
'runtime' => $runtime,
'tag' => '',
'vars' => $vars,
'events' => $events,
@@ -54,7 +54,7 @@ class FunctionsCustomClientTest extends Scope
], [
'name' => 'Test',
'execute' => ['user:'.$this->getUser()['$id']],
'env' => 'php-8.0',
'runtime' => 'php-8.0',
'vars' => [
'funcKey1' => 'funcValue1',
'funcKey2' => 'funcValue2',
@@ -140,7 +140,7 @@ class FunctionsCustomClientTest extends Scope
], [
'name' => 'Test',
'execute' => ['*'],
'env' => 'php-8.0',
'runtime' => 'php-8.0',
'vars' => [
'funcKey1' => 'funcValue1',
'funcKey2' => 'funcValue2',
@@ -24,7 +24,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'name' => 'Test',
'env' => 'php-8.0',
'runtime' => 'php-8.0',
'vars' => [
'funcKey1' => 'funcValue1',
'funcKey2' => 'funcValue2',
@@ -327,7 +327,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertStringContainsString('PHP', $execution['body']['stdout']);
$this->assertStringContainsString('8.0', $execution['body']['stdout']);
$this->assertEquals('', $execution['body']['stderr']);
$this->assertGreaterThan(0.100, $execution['body']['time']);
$this->assertGreaterThan(0.05, $execution['body']['time']);
$this->assertLessThan(0.500, $execution['body']['time']);
/**
@@ -462,7 +462,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'name' => 'Test '.$name,
'env' => $name,
'runtime' => $name,
'vars' => [],
'events' => [],
'schedule' => '',
@@ -540,7 +540,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'name' => 'Test '.$name,
'env' => $name,
'runtime' => $name,
'vars' => [],
'events' => [],
'schedule' => '',