Merge remote-tracking branch 'origin/multi-region-support' into multi-region-support

This commit is contained in:
shimon
2024-12-14 20:23:32 +02:00
6 changed files with 23 additions and 20 deletions
+1 -5
View File
@@ -2895,11 +2895,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents')
}
$collection = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $collectionId));
var_dump('database_' . $database->getInternalId());
var_dump($collectionId);
var_dump($collection);
var_dump($isAPIKey);
var_dump($isPrivilegedUser);
if ($collection->isEmpty() || (!$collection->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) {
throw new Exception(Exception::COLLECTION_NOT_FOUND);
}
-3
View File
@@ -128,7 +128,6 @@ App::post('/v1/projects')
$databases = Config::getParam('pools-database', []);
if ($region !== 'default') {
$databaseKeys = System::getEnv('_APP_DATABASE_KEYS', '');
$keys = explode(',', $databaseKeys);
@@ -235,8 +234,6 @@ App::post('/v1/projects')
$create = false;
}
if ($create || $projectTables) {
$audit = new Audit($dbForProject);
$audit->setup();
+11 -1
View File
@@ -265,7 +265,7 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
$sharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES_V1', ''));
$sharedTablesV2 = \array_diff($sharedTables, $sharedTablesV1);
$region = System::getEnv('_APP_REGION', 'fra');
$region = System::getEnv('_APP_REGION', 'default');
$cache = $app->getResource('cache');
$regionDatabases = \array_filter(
@@ -292,6 +292,16 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
Console::success('[Setup] - Skip: metadata table already exists');
}
if ($dbForProject->getCollection(Audit::COLLECTION)->isEmpty()) {
$audit = new Audit($dbForProject);
$audit->setup();
}
if ($dbForProject->getCollection(TimeLimit::COLLECTION)->isEmpty()) {
$adapter = new TimeLimit("", 0, 1, $dbForProject);
$adapter->setup();
}
foreach ($projectCollections as $key => $collection) {
if (($collection['$collection'] ?? '') !== Database::METADATA) {
continue;
+1 -1
View File
@@ -1334,7 +1334,7 @@ App::setResource('project', function ($dbForPlatform, $request, $console) {
$project = Authorization::skip(fn () => $dbForPlatform->getDocument('projects', $projectId));
if ($project->getAttribute('region') !== System::getEnv('_APP_REGION')) {
if ($project->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) {
var_dump(System::getEnv('_APP_REGION'));
var_dump($project->getAttribute('region'));
throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN, 'Project is not accessible in this region. Please make sure you are using the correct endpoint');
+1 -1
View File
@@ -51,7 +51,7 @@
"utopia-php/cache": "0.11.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.53.200",
"utopia-php/database": "0.53.27",
"utopia-php/domains": "0.5.*",
"utopia-php/dsn": "0.2.1",
"utopia-php/framework": "0.33.*",
Generated
+9 -9
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fae350df93342992edd8f639948e1570",
"content-hash": "cfa976b029b0e8f53ef617056d04face",
"packages": [
{
"name": "adhocore/jwt",
@@ -3476,16 +3476,16 @@
},
{
"name": "utopia-php/database",
"version": "0.53.200",
"version": "0.53.27",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "570c63a3760d0e1404679ddfacd9484af40bd9fc"
"reference": "d3a8cae6e743a6a1a5719b860762a03aabce678a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/570c63a3760d0e1404679ddfacd9484af40bd9fc",
"reference": "570c63a3760d0e1404679ddfacd9484af40bd9fc",
"url": "https://api.github.com/repos/utopia-php/database/zipball/d3a8cae6e743a6a1a5719b860762a03aabce678a",
"reference": "d3a8cae6e743a6a1a5719b860762a03aabce678a",
"shasum": ""
},
"require": {
@@ -3526,9 +3526,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.53.200"
"source": "https://github.com/utopia-php/database/tree/0.53.27"
},
"time": "2024-12-01T07:59:15+00:00"
"time": "2024-12-02T08:53:55+00:00"
},
{
"name": "utopia-php/domains",
@@ -8556,7 +8556,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@@ -8580,5 +8580,5 @@
"platform-overrides": {
"php": "8.3"
},
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.6.0"
}