get project db key by region
This commit is contained in:
parent
7977aaa609
commit
c68e38030f
1 changed files with 6 additions and 4 deletions
|
@ -119,19 +119,21 @@ App::post('/v1/projects')
|
|||
if ($index !== false) {
|
||||
$dsn = $databases[$index];
|
||||
} else {
|
||||
var_dump('region');
|
||||
var_dump($region);
|
||||
if ($region !== 'default') {
|
||||
$databases = array_filter($databases, function ($value) use ($region) {
|
||||
return str_contains($value, $region);
|
||||
});
|
||||
var_dump('databases');
|
||||
var_dump($databases);
|
||||
|
||||
}
|
||||
|
||||
$dsn = $databases[array_rand($databases)];
|
||||
}
|
||||
|
||||
var_dump([
|
||||
'region' => $region,
|
||||
'dsn' => $dsn,
|
||||
]);
|
||||
|
||||
if ($projectId === 'console') {
|
||||
throw new Exception(Exception::PROJECT_RESERVED_PROJECT, "'console' is a reserved project.");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue