Commit e3260239 authored by Aral Balkan's avatar Aral Balkan
Browse files

Update the fs method invocations to clarify intent

(And remove superfluous options.)
parent 45176595
......@@ -174,13 +174,11 @@ export default class Certificate {
// written but before we had a chance to clean up the old files.)
if (fs.existsSync(certificateIdentityPath) && fs.existsSync(certificatePath)) {
log(' 🚑 ❨auto-encrypt❩ A new certificate was also found. Going to delete the old one and use that.')
fs.rmSync(oldCertificateIdentityPath, {recursive: true, force: true})
fs.rmSync(oldCertificatePath, {recursive: true, force: true})
fs.rmSync(oldCertificateIdentityPath)
fs.rmSync(oldCertificatePath)
} else {
// The renewal process must have failed. Delete any previous state and restore the old certificate.
log(' 🚑 ❨auto-encrypt❩ Cleaning up previous state and restoring old certificate…')
fs.rmSync(certificateIdentityPath, {recursive: true, force: true})
fs.rmSync(certificatePath, {recursive: true, force: true})
fs.renameSync(oldCertificateIdentityPath, certificateIdentityPath)
fs.renameSync(oldCertificatePath, certificatePath)
}
......@@ -285,8 +283,6 @@ export default class Certificate {
const certificatePath = this.#configuration.certificatePath
const oldCertificatePath = `${certificatePath}.old`
fs.rmSync(oldCertificateIdentityPath, {recursive: true, force: true})
fs.rmSync(oldCertificatePath, {recursive: true, force: true})
fs.renameSync(certificateIdentityPath, oldCertificateIdentityPath)
fs.renameSync(certificatePath, oldCertificatePath)
......@@ -296,8 +292,8 @@ export default class Certificate {
await this.createSecureContext(/* renewCertificate = */ true)
// Delete the backup of the old certificate.
fs.rmSync(oldCertificateIdentityPath, {recursive: true, force: true})
fs.rmSync(oldCertificatePath, {recursive: true, force: true})
fs.rmSync(oldCertificateIdentityPath)
fs.rmSync(oldCertificatePath)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment