mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +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)
|
->label('sdk.response.model', Response::MODEL_RUNTIME_LIST)
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->action(function (Response $response) {
|
->action(function (Response $response) {
|
||||||
|
|
||||||
$runtimes = Config::getParam('runtimes');
|
$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;
|
$runtimes[$key]['$id'] = $key;
|
||||||
return $runtimes[$key];
|
$allowed[] = $runtimes[$key];
|
||||||
}, array_keys($runtimes));
|
}
|
||||||
|
|
||||||
$response->dynamic(new Document([
|
$response->dynamic(new Document([
|
||||||
'total' => count($runtimes),
|
'total' => count($allowed),
|
||||||
'runtimes' => $runtimes
|
'runtimes' => $allowed
|
||||||
]), Response::MODEL_RUNTIME_LIST);
|
]), Response::MODEL_RUNTIME_LIST);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue