mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge remote-tracking branch 'origin/multi-region-support' into feat-migration-multi-region
# Conflicts: # app/cli.php # app/controllers/api/projects.php # composer.json # composer.lock
This commit is contained in:
@@ -125,11 +125,20 @@ App::post('/v1/projects')
|
||||
|
||||
$databases = Config::getParam('pools-database', []);
|
||||
|
||||
$databases = Config::getParam('pools-database', []);
|
||||
var_dump($databases);
|
||||
$databaseOverride = System::getEnv('_APP_DATABASE_OVERRIDE');
|
||||
$index = \array_search($databaseOverride, $databases);
|
||||
if ($index !== false) {
|
||||
$dsn = $databases[$index];
|
||||
} else {
|
||||
|
||||
if ($region !== 'default') {
|
||||
$databases = array_filter($databases, function ($value) use ($region) {
|
||||
return str_contains($value, $region);
|
||||
});
|
||||
}
|
||||
|
||||
$dsn = $databases[array_rand($databases)];
|
||||
}
|
||||
|
||||
@@ -192,6 +201,9 @@ App::post('/v1/projects')
|
||||
$dsn = new DSN('mysql://' . $dsn);
|
||||
}
|
||||
|
||||
|
||||
var_dump($dsn->getHost());
|
||||
|
||||
$adapter = $pools->get($dsn->getHost())->pop()->getResource();
|
||||
$dbForProject = new Database($adapter, $cache);
|
||||
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
|
||||
@@ -263,6 +275,9 @@ App::post('/v1/projects')
|
||||
continue;
|
||||
}
|
||||
|
||||
$indexes = \array_map(function (array $index) {
|
||||
return new Document($index);
|
||||
}, $collection['indexes']);
|
||||
$attributes = \array_map(fn ($attribute) => new Document($attribute), $collection['attributes']);
|
||||
$indexes = \array_map(fn (array $index) => new Document($index), $collection['indexes']);
|
||||
|
||||
@@ -279,7 +294,7 @@ App::post('/v1/projects')
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
// Hook allowing instant project mirroring during migration
|
||||
// Outside of migration, hook is not registered and has no effect
|
||||
|
||||
Reference in New Issue
Block a user