mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Merge pull request #7659 from appwrite/fix-runtime-list
Only return allowed runtimes in runtime list route
This commit is contained in:
commit
8e7ced68dc
1 changed files with 12 additions and 6 deletions
|
|
@ -420,17 +420,23 @@ App::get('/v1/functions/runtimes')
|
|||
->label('sdk.response.model', Response::MODEL_RUNTIME_LIST)
|
||||
->inject('response')
|
||||
->action(function (Response $response) {
|
||||
|
||||
$runtimes = Config::getParam('runtimes');
|
||||
|
||||
$runtimes = array_map(function ($key) use ($runtimes) {
|
||||
$allowList = \array_filter(\explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES', '')));
|
||||
|
||||
$allowed = [];
|
||||
foreach ($runtimes as $key => $runtime) {
|
||||
if (!empty($allowList) && !\in_array($key, $allowList)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$runtimes[$key]['$id'] = $key;
|
||||
return $runtimes[$key];
|
||||
}, array_keys($runtimes));
|
||||
$allowed[] = $runtimes[$key];
|
||||
}
|
||||
|
||||
$response->dynamic(new Document([
|
||||
'total' => count($runtimes),
|
||||
'runtimes' => $runtimes
|
||||
'total' => count($allowed),
|
||||
'runtimes' => $allowed
|
||||
]), Response::MODEL_RUNTIME_LIST);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue