mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
copilot - code quality
This commit is contained in:
parent
1b70bc812b
commit
2b96d60c1e
4 changed files with 7 additions and 10 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Certificates\Exceptions;
|
||||
namespace Appwrite\Certificates\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Appwrite\Certificates;
|
||||
|
||||
use Appwrite\Certificates\Exceptions\CertificateStatus as CertificateStatusException;
|
||||
use Appwrite\Certificates\Exception\CertificateStatus as CertificateStatusException;
|
||||
use Exception;
|
||||
use Utopia\App;
|
||||
use Utopia\CLI\Console;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class Interval extends Action
|
|||
});
|
||||
}
|
||||
|
||||
private function verifyDomain(Database $dbForPlatform, Certificate $queueForCertificate): void
|
||||
private function verifyDomain(Database $dbForPlatform, Certificate $queueForCertificates): void
|
||||
{
|
||||
$time = DatabaseDateTime::now();
|
||||
$fromTime = new DateTime('-3 days'); // Max 3 days old
|
||||
|
|
@ -63,7 +63,7 @@ class Interval extends Action
|
|||
Console::info("[{$time}] Found " . \count($rules) . " rules for domain verification, scheduling jobs.");
|
||||
|
||||
foreach ($rules as $rule) {
|
||||
$queueForCertificate
|
||||
$queueForCertificates
|
||||
->setDomain(new Document([
|
||||
'domain' => $rule->getAttribute('domain'),
|
||||
'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')),
|
||||
|
|
|
|||
|
|
@ -116,8 +116,6 @@ class Certificates extends Action
|
|||
default:
|
||||
throw new Exception('Invalid action: ' . $action);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -143,7 +141,7 @@ class Certificates extends Action
|
|||
Realtime $queueForRealtime,
|
||||
Certificate $queueForCertificates,
|
||||
Log $log,
|
||||
?string $validationDomain = null,
|
||||
?string $validationDomain = null
|
||||
): void {
|
||||
// Get rule
|
||||
$rule = System::getEnv('_APP_RULES_FORMAT') === 'md5'
|
||||
|
|
@ -177,7 +175,6 @@ class Certificates extends Action
|
|||
$this->updateRuleAndSendEvents($rule, $dbForPlatform, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime);
|
||||
}
|
||||
|
||||
|
||||
// Issue a TLS certificate when domain is verified
|
||||
if ($rule->getAttribute('status', '') === RULE_STATUS_CERTIFICATE_GENERATING) {
|
||||
$queueForCertificates
|
||||
|
|
@ -317,7 +314,7 @@ class Certificates extends Action
|
|||
$date = \date('H:i:s');
|
||||
$errorMessage = "\033[90m[{$date}] \033[31mCertificate generation failed: \033[0m\n";
|
||||
|
||||
$attempts = $certificate->getAttribute('attempts', 0) + 1; // // Increase attempts count
|
||||
$attempts = $certificate->getAttribute('attempts', 0) + 1; // Increase attempts count
|
||||
|
||||
// Update attributes on certificate document
|
||||
$certificate->setAttributes([
|
||||
|
|
@ -379,7 +376,7 @@ class Certificates extends Action
|
|||
|
||||
/**
|
||||
* Update all existing domain documents so they have relation to correct certificate document.
|
||||
* This solved issues:
|
||||
* This solves issues:
|
||||
* - when adding a domain for which there is already a certificate
|
||||
* - when renew creates new document? It might?
|
||||
* - overall makes it more reliable
|
||||
|
|
|
|||
Loading…
Reference in a new issue