reverseproxy: use async exec

This commit is contained in:
Girish Ramakrishnan
2024-02-21 12:33:04 +01:00
parent 9b94cf18d0
commit c1bb4de6a3
5 changed files with 90 additions and 81 deletions

View File

@@ -1818,10 +1818,7 @@ async function setCertificate(app, data, auditSource) {
const domainObject = await domains.get(domain);
if (domainObject === null) throw new BoxError(BoxError.NOT_FOUND, 'Domain not found');
if (cert && key) {
const error = reverseProxy.validateCertificate(subdomain, domain, { cert, key });
if (error) throw error;
}
if (cert && key) await reverseProxy.validateCertificate(subdomain, domain, { cert, key });
const certificate = cert && key ? { cert, key } : null;
const result = await database.query('UPDATE locations SET certificateJson=? WHERE location=? AND domain=?', [ certificate ? JSON.stringify(certificate) : null, subdomain, domain ]);