tls: remove any old location certs
This commit is contained in:
@@ -286,6 +286,13 @@ async function setupTlsAddon(app) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
|
||||
const certificateDir = `${paths.PLATFORM_DATA_DIR}/tls/${app.id}`;
|
||||
|
||||
// clean up any certs of old locations
|
||||
const filenames = safe.fs.readdirSync(certificateDir) || [];
|
||||
for (const filename of filenames) {
|
||||
safe.fs.unlinkSync(path.join(certificateDir, filename));
|
||||
}
|
||||
|
||||
for (const location of getAppLocationsSync(app)) {
|
||||
const certificate = await getCertificate(location);
|
||||
writeFileSync(`${certificateDir}/${location.fqdn}.cert`, certificate.cert);
|
||||
|
||||
Reference in New Issue
Block a user