mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
adding app region to console project
This commit is contained in:
parent
b5efbdbb0f
commit
a0280e3c43
1 changed files with 6 additions and 1 deletions
|
|
@ -1334,6 +1334,10 @@ App::setResource('project', function ($dbForConsole, $request, $console) {
|
|||
|
||||
$project = Authorization::skip(fn () => $dbForConsole->getDocument('projects', $projectId));
|
||||
|
||||
if($project->getAttribute('region') !== System::getEnv('_APP_REGION')){
|
||||
throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN, 'Project is not accessible in this region. Please make sure you are using the correct endpoint');
|
||||
}
|
||||
|
||||
return $project;
|
||||
}, ['dbForConsole', 'request', 'console']);
|
||||
|
||||
|
|
@ -1397,10 +1401,11 @@ App::setResource('console', function () {
|
|||
'githubSecret' => System::getEnv('_APP_CONSOLE_GITHUB_SECRET', ''),
|
||||
'githubAppid' => System::getEnv('_APP_CONSOLE_GITHUB_APP_ID', '')
|
||||
],
|
||||
'region' => System::getEnv('_APP_REGION', 'default')
|
||||
]);
|
||||
}, []);
|
||||
|
||||
App::setResource('dbForProject', function (Group $pools, Database $dbForConsole, Cache $cache, Document $project) {
|
||||
App::setResource('dbForPltroject', function (Group $pools, Database $dbForConsole, Cache $cache, Document $project) {
|
||||
if ($project->isEmpty() || $project->getId() === 'console') {
|
||||
return $dbForConsole;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue