mirror of
https://github.com/appwrite/appwrite
synced 2026-05-21 16:08:22 +00:00
Merge branch 'main' into upsert-single-document-route
This commit is contained in:
commit
eb05e8c35c
8 changed files with 21 additions and 13 deletions
|
|
@ -478,7 +478,7 @@ return [
|
|||
'frameworks' => [
|
||||
getFramework('FLUTTER', [
|
||||
'providerRootDirectory' => './',
|
||||
'buildCommand' => 'bash build.sh',
|
||||
'buildCommand' => 'bash prepare.sh && bash build.sh',
|
||||
]),
|
||||
],
|
||||
'vcsProvider' => 'github',
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ use Utopia\Logger\Log;
|
|||
|
||||
interface Adapter
|
||||
{
|
||||
public function issueCertificate(string $certName, string $domain): ?string;
|
||||
public function issueCertificate(string $certName, string $domain, ?string $domainType): ?string;
|
||||
|
||||
public function isRenewRequired(string $domain, Log $log): bool;
|
||||
public function isRenewRequired(string $domain, ?string $domainType, Log $log): bool;
|
||||
|
||||
public function deleteCertificate(string $domain): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class LetsEncrypt implements Adapter
|
|||
}
|
||||
|
||||
|
||||
public function issueCertificate(string $certName, string $domain): ?string
|
||||
public function issueCertificate(string $certName, string $domain, ?string $domainType): ?string
|
||||
{
|
||||
$stdout = '';
|
||||
$stderr = '';
|
||||
|
|
@ -84,7 +84,7 @@ class LetsEncrypt implements Adapter
|
|||
return DateTime::addSeconds($dt, -60 * 60 * 24 * 30);
|
||||
}
|
||||
|
||||
public function isRenewRequired(string $domain, Log $log): bool
|
||||
public function isRenewRequired(string $domain, ?string $domainType, Log $log): bool
|
||||
{
|
||||
$certPath = APP_STORAGE_CERTIFICATES . '/' . $domain . '/cert.pem';
|
||||
if (\file_exists($certPath)) {
|
||||
|
|
|
|||
|
|
@ -173,7 +173,8 @@ class Create extends Action
|
|||
if ($rule->getAttribute('status', '') === 'verifying') {
|
||||
$queueForCertificates
|
||||
->setDomain(new Document([
|
||||
'domain' => $rule->getAttribute('domain')
|
||||
'domain' => $rule->getAttribute('domain'),
|
||||
'domainType' => 'api',
|
||||
]))
|
||||
->trigger();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ class Create extends Action
|
|||
if ($rule->getAttribute('status', '') === 'verifying') {
|
||||
$queueForCertificates
|
||||
->setDomain(new Document([
|
||||
'domain' => $rule->getAttribute('domain')
|
||||
'domain' => $rule->getAttribute('domain'),
|
||||
'domainType' => 'function',
|
||||
]))
|
||||
->trigger();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,8 @@ class Create extends Action
|
|||
if ($rule->getAttribute('status', '') === 'verifying') {
|
||||
$queueForCertificates
|
||||
->setDomain(new Document([
|
||||
'domain' => $rule->getAttribute('domain')
|
||||
'domain' => $rule->getAttribute('domain'),
|
||||
'domainType' => 'redirect',
|
||||
]))
|
||||
->trigger();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ class Create extends Action
|
|||
if ($rule->getAttribute('status', '') === 'verifying') {
|
||||
$queueForCertificates
|
||||
->setDomain(new Document([
|
||||
'domain' => $rule->getAttribute('domain')
|
||||
'domain' => $rule->getAttribute('domain'),
|
||||
'domainType' => 'site',
|
||||
]))
|
||||
->trigger();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class Certificates extends Action
|
|||
->inject('log')
|
||||
->inject('certificates')
|
||||
->inject('plan')
|
||||
->callback([$this, 'action']);
|
||||
->callback($this->action(...));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -96,11 +96,14 @@ class Certificates extends Action
|
|||
|
||||
$log->addTag('domain', $domain->get());
|
||||
|
||||
$this->execute($domain, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck, $plan);
|
||||
$domainType = $payload['domainType'] ?? null;
|
||||
|
||||
$this->execute($domain, $domainType, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck, $plan);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Domain $domain
|
||||
* @param ?string $domainType
|
||||
* @param Database $dbForPlatform
|
||||
* @param Mail $queueForMails
|
||||
* @param Event $queueForEvents
|
||||
|
|
@ -115,6 +118,7 @@ class Certificates extends Action
|
|||
*/
|
||||
private function execute(
|
||||
Domain $domain,
|
||||
?string $domainType,
|
||||
Database $dbForPlatform,
|
||||
Mail $queueForMails,
|
||||
Event $queueForEvents,
|
||||
|
|
@ -174,7 +178,7 @@ class Certificates extends Action
|
|||
$this->validateDomain($domain, $isMainDomain, $log);
|
||||
|
||||
// If certificate exists already, double-check expiry date. Skip if job is forced
|
||||
if (!$certificates->isRenewRequired($domain->get(), $log)) {
|
||||
if (!$certificates->isRenewRequired($domain->get(), $domainType, $log)) {
|
||||
Console::info("Skipping, renew isn't required");
|
||||
return;
|
||||
}
|
||||
|
|
@ -182,7 +186,7 @@ class Certificates extends Action
|
|||
|
||||
// Prepare unique cert name. Using this helps prevent miss-match in configuration when renewing certificates.
|
||||
$certName = ID::unique();
|
||||
$renewDate = $certificates->issueCertificate($certName, $domain->get());
|
||||
$renewDate = $certificates->issueCertificate($certName, $domain->get(), $domainType);
|
||||
|
||||
// Command succeeded, store all data into document
|
||||
$certificate->setAttribute('logs', 'Certificate successfully generated.');
|
||||
|
|
|
|||
Loading…
Reference in a new issue