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) {
|
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.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue