Get default region param from env
This commit is contained in:
parent
1e1ab2a8ae
commit
bb01a6d817
1 changed files with 5 additions and 1 deletions
|
@ -59,7 +59,7 @@ App::post('/v1/projects')
|
||||||
->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
|
->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `ID.unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
|
||||||
->param('name', null, new Text(128), 'Project name. Max length: 128 chars.')
|
->param('name', null, new Text(128), 'Project name. Max length: 128 chars.')
|
||||||
->param('teamId', '', new UID(), 'Team unique ID.')
|
->param('teamId', '', new UID(), 'Team unique ID.')
|
||||||
->param('region', 'default', new Whitelist(array_keys(array_filter(Config::getParam('regions'), fn($config) => !$config['disabled']))), 'Project Region.', true)
|
->param('region', '', new Whitelist(array_keys(array_filter(Config::getParam('regions'), fn($config) => !$config['disabled']))), 'Project Region.', true)
|
||||||
->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true)
|
->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true)
|
||||||
->param('logo', '', new Text(1024), 'Project logo.', true)
|
->param('logo', '', new Text(1024), 'Project logo.', true)
|
||||||
->param('url', '', new URL(), 'Project URL.', true)
|
->param('url', '', new URL(), 'Project URL.', true)
|
||||||
|
@ -92,6 +92,10 @@ App::post('/v1/projects')
|
||||||
throw new Exception(Exception::PROJECT_RESERVED_PROJECT, "'console' is a reserved project.");
|
throw new Exception(Exception::PROJECT_RESERVED_PROJECT, "'console' is a reserved project.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (\empty($region)) {
|
||||||
|
$region = App::getEnv('_APP_REGION', 'default');
|
||||||
|
}
|
||||||
|
|
||||||
$project = $dbForConsole->createDocument('projects', new Document([
|
$project = $dbForConsole->createDocument('projects', new Document([
|
||||||
'$id' => $projectId,
|
'$id' => $projectId,
|
||||||
'$permissions' => [
|
'$permissions' => [
|
||||||
|
|
Loading…
Reference in a new issue