regions using config instead
This commit is contained in:
parent
f46327d206
commit
ed81ff1263
3
.env
3
.env
|
@ -81,9 +81,6 @@ _APP_USAGE_DATABASE_INTERVAL=15
|
|||
_APP_USAGE_STATS=enabled
|
||||
_APP_LOGGING_PROVIDER=
|
||||
_APP_LOGGING_CONFIG=
|
||||
_APP_REGION_DEFAULT=default
|
||||
_APP_REGIONS=default,nyc,frank
|
||||
_APP_REGIONS_DISABLED=nyc
|
||||
DOCKERHUB_PULL_USERNAME=
|
||||
DOCKERHUB_PULL_PASSWORD=
|
||||
DOCKERHUB_PULL_EMAIL=
|
|
@ -255,10 +255,7 @@ ENV _APP_SERVER=swoole \
|
|||
_APP_MAINTENANCE_RETENTION_ABUSE=86400 \
|
||||
_APP_MAINTENANCE_INTERVAL=86400 \
|
||||
_APP_LOGGING_PROVIDER= \
|
||||
_APP_LOGGING_CONFIG= \
|
||||
_APP_REGIONS=default \
|
||||
_APP_REGION_DEFAULT=default \
|
||||
_APP_REGIONS_DISABLED=
|
||||
_APP_LOGGING_CONFIG=
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
|
|
18
app/config/regions.php
Normal file
18
app/config/regions.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
return [
|
||||
'default' => [
|
||||
'name' => 'Default',
|
||||
'default' => true,
|
||||
'disabled' => false,
|
||||
],
|
||||
'fra001' => [
|
||||
'name' => 'Frankfurt',
|
||||
'default' => false,
|
||||
'disabled' => false,
|
||||
],
|
||||
'nyc001' => [
|
||||
'name' => 'New York',
|
||||
'default' => false,
|
||||
'disabled' => true,
|
||||
],
|
||||
];
|
|
@ -58,7 +58,7 @@ App::post('/v1/projects')
|
|||
->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "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('teamId', '', new UID(), 'Team unique ID.')
|
||||
->param('region', '', new Whitelist(explode(',', App::getEnv('_APP_REGIONS', ''))), '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('logo', '', new Text(1024), 'Project logo.', true)
|
||||
->param('url', '', new URL(), 'Project URL.', true)
|
||||
|
|
|
@ -29,9 +29,7 @@ App::shutdown()
|
|||
$footer = new View(__DIR__ . '/../../views/console/comps/footer.phtml');
|
||||
|
||||
$header
|
||||
->setParam('regions', explode(',', App::getEnv('_APP_REGIONS', '')))
|
||||
->setParam('disabledRegions', explode(',', App::getEnv('_APP_REGIONS_DISABLED', '')))
|
||||
->setParam('defaultRegion', App::getEnv('_APP_REGION_DEFAULT', 'default'))
|
||||
->setParam('regions', Config::getParam('regions', []))
|
||||
;
|
||||
|
||||
$footer
|
||||
|
|
|
@ -27,7 +27,7 @@ $http = new Server("0.0.0.0", App::getEnv('PORT', 80));
|
|||
|
||||
$payloadSize = 6 * (1024 * 1024); // 6MB
|
||||
$workerNumber = swoole_cpu_num() * intval(App::getEnv('_APP_WORKER_PER_CORE', 6));
|
||||
var_dump(explode(',', App::getEnv('_APP_REGIONS', '')));
|
||||
var_dump(App::getEnv('_APP_REGION_DEFAULT', ''));
|
||||
$http
|
||||
->set([
|
||||
'worker_num' => $workerNumber,
|
||||
|
|
|
@ -188,6 +188,7 @@ Config::load('roles', __DIR__ . '/config/roles.php'); // User roles and scopes
|
|||
Config::load('scopes', __DIR__ . '/config/scopes.php'); // User roles and scopes
|
||||
Config::load('services', __DIR__ . '/config/services.php'); // List of services
|
||||
Config::load('variables', __DIR__ . '/config/variables.php'); // List of env variables
|
||||
Config::load('regions', __DIR__ . '/config/regions.php'); // List of available regions
|
||||
Config::load('avatar-browsers', __DIR__ . '/config/avatars/browsers.php');
|
||||
Config::load('avatar-credit-cards', __DIR__ . '/config/avatars/credit-cards.php');
|
||||
Config::load('avatar-flags', __DIR__ . '/config/avatars/flags.php');
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
$regions = $this->getParam('regions', []);
|
||||
$disabledRegions = $this->getParam('disabledRegions', []);
|
||||
$defaultRegion = $this->getParam('defaultRegion', []);
|
||||
?>
|
||||
<header class="clear" data-version>
|
||||
<a href="/console" class="logo pull-start">
|
||||
|
@ -225,12 +223,10 @@ $defaultRegion = $this->getParam('defaultRegion', []);
|
|||
<?php if(count($regions) > 1): ?>
|
||||
<label>Region</label>
|
||||
<select name="region" class="margin-bottom-xl">
|
||||
<?php foreach($regions as $region): ?>
|
||||
<option <?php echo in_array($region, $disabledRegions) ? 'disabled' : '' ?> value="<?php echo $region ?>"><?php echo $region ?></option>
|
||||
<?php foreach($regions as $key => $region): ?>
|
||||
<option <?php echo ($region['default'] ?? false) ? 'selected' : '' ?> <?php echo ($region['disabled'] ?? false ) ? 'disabled' : '' ?> value="<?php echo $key ?>"><?php echo $region['name'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="region" data-ls-bind="{{$defaultRegion}}" class="margin-bottom-xl" />
|
||||
<?php endif; ?>
|
||||
|
||||
<footer>
|
||||
|
|
|
@ -176,9 +176,6 @@ services:
|
|||
- _APP_MAINTENANCE_RETENTION_AUDIT
|
||||
- _APP_SMS_PROVIDER
|
||||
- _APP_SMS_FROM
|
||||
- _APP_REGION_DEFAULT
|
||||
- _APP_REGIONS
|
||||
- _APP_REGIONS_DISABLED
|
||||
|
||||
appwrite-realtime:
|
||||
entrypoint: realtime
|
||||
|
|
Loading…
Reference in a new issue