Skip to content

Commit 93c8d9e

Browse files
committed
Add lots more ACME & cert cache logging to help debug issues
1 parent 657e1db commit 93c8d9e

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/tls-certificates/acme.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ export class AcmeCA {
145145
throw new Error(`Unexpected ${challenge.type} challenge`);
146146
}
147147

148+
console.log(`Removing ACME ${
149+
challenge.status
150+
} ${
151+
challenge.type
152+
} challenge (validated: ${
153+
challenge.validated
154+
}, error: ${
155+
JSON.stringify(challenge.error)
156+
})`)
157+
148158
this.pendingAcmeChallenges[challenge.token];
149159
}
150160
});

src/tls-certificates/cert-cache.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export class PersistentCertCache {
2727
}
2828
});
2929

30+
console.log(`Starting up with ${certFiles.length} certificates cached: ${
31+
certFiles.map(f => `'${f}'`).join(', ')
32+
}`);
33+
3034
await Promise.all(certFiles.map(async (certPath) => {
3135
if (!certPath.endsWith('.cert.json')) {
3236
console.log(`Unexpected file in cert dir: ${certPath}`);
@@ -59,8 +63,9 @@ export class PersistentCertCache {
5963
JSON.stringify(cert)
6064
).catch((e) => {
6165
console.warn(`Failed to cache to disk certificate data for ${domain}`);
62-
})
66+
});
6367

68+
console.log(`Cached cert for ${domain}`);
6469
return this.cache[domain];
6570
}
6671

@@ -69,7 +74,14 @@ export class PersistentCertCache {
6974
}
7075

7176
getCert(domain: string): CachedCertificate | undefined {
72-
return this.cache[domain];
77+
const cert = this.cache[domain];
78+
79+
console.log(cert
80+
? `Found cached cert for ${domain}`
81+
: `No cert available for ${domain}`
82+
);
83+
84+
return cert;
7385
}
7486

7587
}

0 commit comments

Comments
 (0)