mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Allow same certificate with multiple projects (same domain)
This commit is contained in:
parent
154379c848
commit
213215bffa
1 changed files with 17 additions and 0 deletions
|
|
@ -98,6 +98,23 @@ class CertificatesV1 extends Worker
|
|||
&& isset($certificate['issueDate'])
|
||||
&& (($certificate['issueDate'] + ($expiry)) > \time())
|
||||
) { // Check last issue time
|
||||
|
||||
// Update document anyway, if needed
|
||||
// This occurs when a cert is already generated because a different project is using the domain
|
||||
// By updating here we ensure all domains has certificateId assigned (share same certificate document)
|
||||
if(!isset($document['certificateId'])) {
|
||||
$certificate = new Document(\array_merge($document, [
|
||||
'updated' => \time(),
|
||||
'certificateId' => $certificate->getId(),
|
||||
]));
|
||||
|
||||
$certificate = $dbForConsole->updateDocument('domains', $certificate->getId(), $certificate);
|
||||
|
||||
if(!$certificate) {
|
||||
throw new Exception('Failed saving domain to DB');
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception('Renew isn\'t required');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue