Merge pull request #8503 from appwrite/feat-base-runtimes

feat: base runtimes key
This commit is contained in:
Christy Jacob
2024-08-12 13:41:54 +04:00
committed by GitHub
3 changed files with 11 additions and 4 deletions
+4 -4
View File
@@ -431,13 +431,13 @@ App::get('/v1/functions/runtimes')
$allowList = \array_filter(\explode(',', System::getEnv('_APP_FUNCTIONS_RUNTIMES', '')));
$allowed = [];
foreach ($runtimes as $key => $runtime) {
if (!empty($allowList) && !\in_array($key, $allowList)) {
foreach ($runtimes as $id => $runtime) {
if (!empty($allowList) && !\in_array($id, $allowList)) {
continue;
}
$runtimes[$key]['$id'] = $key;
$allowed[] = $runtimes[$key];
$runtime['$id'] = $id;
$allowed[] = $runtime;
}
$response->dynamic(new Document([
@@ -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.',
@@ -1429,6 +1429,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertArrayHasKey('$id', $runtime);
$this->assertArrayHasKey('name', $runtime);
$this->assertArrayHasKey('key', $runtime);
$this->assertArrayHasKey('version', $runtime);
$this->assertArrayHasKey('logo', $runtime);
$this->assertArrayHasKey('image', $runtime);