1
0
Fork 0
mirror of synced 2024-09-20 11:37:45 +12:00

get project db key by region

This commit is contained in:
shimon 2024-08-05 10:20:40 +03:00
parent 7977aaa609
commit c68e38030f

View file

@ -119,19 +119,21 @@ App::post('/v1/projects')
if ($index !== false) { if ($index !== false) {
$dsn = $databases[$index]; $dsn = $databases[$index];
} else { } else {
var_dump('region');
var_dump($region);
if ($region !== 'default') { if ($region !== 'default') {
$databases = array_filter($databases, function ($value) use ($region) { $databases = array_filter($databases, function ($value) use ($region) {
return str_contains($value, $region); return str_contains($value, $region);
}); });
var_dump('databases');
var_dump($databases);
} }
$dsn = $databases[array_rand($databases)]; $dsn = $databases[array_rand($databases)];
} }
var_dump([
'region' => $region,
'dsn' => $dsn,
]);
if ($projectId === 'console') { if ($projectId === 'console') {
throw new Exception(Exception::PROJECT_RESERVED_PROJECT, "'console' is a reserved project."); throw new Exception(Exception::PROJECT_RESERVED_PROJECT, "'console' is a reserved project.");
} }