reverseproxy: add setUserCertificate
This commit is contained in:
@@ -1779,12 +1779,12 @@ async function setCertificate(app, data, auditSource) {
|
||||
if (error) throw error;
|
||||
}
|
||||
|
||||
const certificateJson = cert && key ? JSON.stringify({ cert, key }) : null;
|
||||
const result = await database.query('UPDATE locations SET certificateJson=? WHERE location=? AND domain=?', [ certificateJson, subdomain, domain ]);
|
||||
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 ]);
|
||||
if (result.affectedRows === 0) throw new BoxError(BoxError.NOT_FOUND, 'Location not found');
|
||||
|
||||
app = await get(app.id); // refresh app object
|
||||
await reverseProxy.writeAppConfigs(app);
|
||||
await reverseProxy.setUserCertificate(app, dns.fqdn(subdomain, domainObject), certificate);
|
||||
await eventlog.add(eventlog.ACTION_APP_CONFIGURE, auditSource, { appId: app.id, app, subdomain, domain, cert });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user