Merge branch '1.4.x' of github.com:appwrite/appwrite into cl-1.4.x

This commit is contained in:
shimon 2023-10-19 19:42:03 +03:00
commit aa9b057632
4 changed files with 23 additions and 23 deletions

View file

@ -92,12 +92,12 @@ App::post('/v1/projects')
$projectId = ($projectId == 'unique()') ? ID::unique() : $projectId; $projectId = ($projectId == 'unique()') ? ID::unique() : $projectId;
$backups['database_db_fra1_v14x_02'] = ['from' => '7:30', 'to' => '8:15']; $backups['database_db_fra1_v14x_02'] = ['from' => '03:00', 'to' => '04:00'];
$backups['database_db_fra1_v14x_03'] = ['from' => '10:30', 'to' => '11:15']; $backups['database_db_fra1_v14x_03'] = ['from' => '00:00', 'to' => '01:00'];
$backups['database_db_fra1_v14x_04'] = ['from' => '13:30', 'to' => '14:15']; $backups['database_db_fra1_v14x_04'] = ['from' => '00:00', 'to' => '01:00'];
$backups['database_db_fra1_v14x_05'] = ['from' => '4:30', 'to' => '5:15']; $backups['database_db_fra1_v14x_05'] = ['from' => '00:00', 'to' => '01:00'];
$backups['database_db_fra1_v14x_06'] = ['from' => '16:30', 'to' => '17:15']; $backups['database_db_fra1_v14x_06'] = ['from' => '00:00', 'to' => '01:00'];
$backups['database_db_fra1_v14x_07'] = ['from' => '19:30', 'to' => '20:15']; $backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '01:00'];
$databases = Config::getParam('pools-database', []); $databases = Config::getParam('pools-database', []);

View file

@ -37,10 +37,11 @@ App::post('/v1/proxy/rules')
->param('resourceId', '', new UID(), 'ID of resource for the action type. If resourceType is "api", leave empty. If resourceType is "function", provide ID of the function.', true) ->param('resourceId', '', new UID(), 'ID of resource for the action type. If resourceType is "api", leave empty. If resourceType is "function", provide ID of the function.', true)
->inject('response') ->inject('response')
->inject('project') ->inject('project')
->inject('events') ->inject('queueForCertificates')
->inject('queueForEvents')
->inject('dbForConsole') ->inject('dbForConsole')
->inject('dbForProject') ->inject('dbForProject')
->action(function (string $domain, string $resourceType, string $resourceId, Response $response, Document $project, Event $events, Database $dbForConsole, Database $dbForProject) { ->action(function (string $domain, string $resourceType, string $resourceId, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForConsole, Database $dbForProject) {
$mainDomain = App::getEnv('_APP_DOMAIN', ''); $mainDomain = App::getEnv('_APP_DOMAIN', '');
if ($domain === $mainDomain) { if ($domain === $mainDomain) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your main domain to specific resource. Please use subdomain or a different domain.'); throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your main domain to specific resource. Please use subdomain or a different domain.');
@ -113,8 +114,7 @@ App::post('/v1/proxy/rules')
if ($validator->isValid($domain->get())) { if ($validator->isValid($domain->get())) {
$status = 'verifying'; $status = 'verifying';
$event = new Certificate(); $queueForCertificates
$event
->setDomain(new Document([ ->setDomain(new Document([
'domain' => $rule->getAttribute('domain') 'domain' => $rule->getAttribute('domain')
])) ]))
@ -125,7 +125,7 @@ App::post('/v1/proxy/rules')
$rule->setAttribute('status', $status); $rule->setAttribute('status', $status);
$rule = $dbForConsole->createDocument('rules', $rule); $rule = $dbForConsole->createDocument('rules', $rule);
$events->setParam('ruleId', $rule->getId()); $queueForEvents->setParam('ruleId', $rule->getId());
$rule->setAttribute('logs', ''); $rule->setAttribute('logs', '');
@ -235,9 +235,9 @@ App::delete('/v1/proxy/rules/:ruleId')
->inject('response') ->inject('response')
->inject('project') ->inject('project')
->inject('dbForConsole') ->inject('dbForConsole')
->inject('deletes') ->inject('queueForDeletes')
->inject('events') ->inject('queueForEvents')
->action(function (string $ruleId, Response $response, Document $project, Database $dbForConsole, Delete $deletes, Event $events) { ->action(function (string $ruleId, Response $response, Document $project, Database $dbForConsole, Delete $queueForDeletes, Event $queueForEvents) {
$rule = $dbForConsole->getDocument('rules', $ruleId); $rule = $dbForConsole->getDocument('rules', $ruleId);
if ($rule->isEmpty() || $rule->getAttribute('projectInternalId') !== $project->getInternalId()) { if ($rule->isEmpty() || $rule->getAttribute('projectInternalId') !== $project->getInternalId()) {
@ -246,11 +246,11 @@ App::delete('/v1/proxy/rules/:ruleId')
$dbForConsole->deleteDocument('rules', $rule->getId()); $dbForConsole->deleteDocument('rules', $rule->getId());
$deletes $queueForDeletes
->setType(DELETE_TYPE_DOCUMENT) ->setType(DELETE_TYPE_DOCUMENT)
->setDocument($rule); ->setDocument($rule);
$events->setParam('ruleId', $rule->getId()); $queueForEvents->setParam('ruleId', $rule->getId());
$response->noContent(); $response->noContent();
}); });
@ -270,10 +270,11 @@ App::patch('/v1/proxy/rules/:ruleId/verification')
->label('sdk.response.model', Response::MODEL_PROXY_RULE) ->label('sdk.response.model', Response::MODEL_PROXY_RULE)
->param('ruleId', '', new UID(), 'Rule ID.') ->param('ruleId', '', new UID(), 'Rule ID.')
->inject('response') ->inject('response')
->inject('events') ->inject('queueForCertificates')
->inject('queueForEvents')
->inject('project') ->inject('project')
->inject('dbForConsole') ->inject('dbForConsole')
->action(function (string $ruleId, Response $response, Event $events, Document $project, Database $dbForConsole) { ->action(function (string $ruleId, Response $response, Certificate $queueForCertificates, Event $queueForEvents, Document $project, Database $dbForConsole) {
$rule = $dbForConsole->getDocument('rules', $ruleId); $rule = $dbForConsole->getDocument('rules', $ruleId);
if ($rule->isEmpty() || $rule->getAttribute('projectInternalId') !== $project->getInternalId()) { if ($rule->isEmpty() || $rule->getAttribute('projectInternalId') !== $project->getInternalId()) {
@ -300,14 +301,13 @@ App::patch('/v1/proxy/rules/:ruleId/verification')
$dbForConsole->updateDocument('rules', $rule->getId(), $rule->setAttribute('status', 'verifying')); $dbForConsole->updateDocument('rules', $rule->getId(), $rule->setAttribute('status', 'verifying'));
// Issue a TLS certificate when domain is verified // Issue a TLS certificate when domain is verified
$event = new Certificate(); $queueForCertificates
$event
->setDomain(new Document([ ->setDomain(new Document([
'domain' => $rule->getAttribute('domain') 'domain' => $rule->getAttribute('domain')
])) ]))
->trigger(); ->trigger();
$events->setParam('ruleId', $rule->getId()); $queueForEvents->setParam('ruleId', $rule->getId());
$certificate = $dbForConsole->getDocument('certificates', $rule->getAttribute('certificateId', '')); $certificate = $dbForConsole->getDocument('certificates', $rule->getAttribute('certificateId', ''));
$rule->setAttribute('logs', $certificate->getAttribute('logs', '')); $rule->setAttribute('logs', $certificate->getAttribute('logs', ''));

View file

@ -667,7 +667,7 @@ services:
<<: *x-logging <<: *x-logging
restart: unless-stopped restart: unless-stopped
stop_signal: SIGINT stop_signal: SIGINT
image: openruntimes/executor:0.4.4 image: openruntimes/executor:0.4.5
networks: networks:
- appwrite - appwrite
- runtimes - runtimes

View file

@ -722,7 +722,7 @@ services:
hostname: appwrite-executor hostname: appwrite-executor
<<: *x-logging <<: *x-logging
stop_signal: SIGINT stop_signal: SIGINT
image: openruntimes/executor:0.4.4 image: openruntimes/executor:0.4.5
restart: unless-stopped restart: unless-stopped
networks: networks:
- appwrite - appwrite