Simplify allow list
This commit is contained in:
parent
eb4d6f8e20
commit
6c4b0ecd5b
2 changed files with 2 additions and 6 deletions
|
@ -172,9 +172,7 @@ App::post('/v1/functions')
|
|||
->action(function (string $functionId, string $name, string $runtime, array $execute, array $events, string $schedule, int $timeout, bool $enabled, bool $logging, string $entrypoint, string $commands, string $installationId, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateBranch, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github) use ($redeployVcs) {
|
||||
$functionId = ($functionId == 'unique()') ? ID::unique() : $functionId;
|
||||
|
||||
$allowList = empty(App::getEnv('_APP_FUNCTIONS_RUNTIMES'))
|
||||
? []
|
||||
: \explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES'));
|
||||
$allowList = \array_filter(\explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES', '')));
|
||||
|
||||
if (!empty($allowList) && !\in_array($runtime, $allowList)) {
|
||||
throw new Exception(Exception::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $runtime . '" is not supported');
|
||||
|
|
|
@ -84,9 +84,7 @@ App::post('/v1/projects')
|
|||
throw new Exception(Exception::TEAM_NOT_FOUND);
|
||||
}
|
||||
|
||||
$allowList = empty(App::getEnv('_APP_PROJECT_REGIONS'))
|
||||
? []
|
||||
: \explode(',', App::getEnv('_APP_PROJECT_REGIONS'));
|
||||
$allowList = \array_filter(\explode(',', App::getEnv('_APP_PROJECT_REGIONS', '')));
|
||||
|
||||
if (!empty($allowList) && !\in_array($region, $allowList)) {
|
||||
throw new Exception(Exception::PROJECT_REGION_UNSUPPORTED, 'Region "' . $region . '" is not supported');
|
||||
|
|
Loading…
Reference in a new issue