fix(backend): run prettier and yarn add node-forge
Signed-off-by: Johannes Grumboeck <johannes@grumboeck.net>
This commit is contained in:
@@ -75,6 +75,7 @@
|
||||
"morgan": "^1.10.0",
|
||||
"node-abort-controller": "^3.0.1",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-forge": "^1.3.1",
|
||||
"raw-body": "^2.4.1",
|
||||
"request": "^2.88.2",
|
||||
"selfsigned": "^2.0.0",
|
||||
|
||||
@@ -99,17 +99,17 @@ async function getGeneratedCertificate(hostname: string, logger?: Logger) {
|
||||
if (await fs.pathExists(certPath)) {
|
||||
cert = await fs.readFile(certPath);
|
||||
try {
|
||||
const forge = require('node-forge')
|
||||
const crt = forge.pki.certificateFromPem(cert)
|
||||
const forge = require('node-forge');
|
||||
const crt = forge.pki.certificateFromPem(cert);
|
||||
const crtTimestamp = Date.parse(crt.validity.notAfter);
|
||||
remainingMs = crtTimestamp - Date.now();
|
||||
} catch (error) {
|
||||
logger?.warn(`Unable to parse self-signed certificate. ${error}`);
|
||||
remainingMs = 0
|
||||
remainingMs = 0;
|
||||
}
|
||||
if (remainingMs < FIVE_DAYS_IN_MS) {
|
||||
// Reset certificate if expiration is nearly over
|
||||
cert = undefined
|
||||
cert = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user