feat(certmanagers/integration): Add optional wipe methods to certificate managers and update integration tests, plus bump tapbundle dependency
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartacme',
|
||||
version: '7.0.0',
|
||||
version: '7.1.0',
|
||||
description: 'A TypeScript-based ACME client for LetsEncrypt certificate management with a focus on simplicity and power.'
|
||||
}
|
||||
|
@ -38,6 +38,14 @@ export class MemoryCertManager implements ICertManager {
|
||||
public async close(): Promise<void> {
|
||||
// no-op
|
||||
}
|
||||
/**
|
||||
* Wipe all certificates from the in-memory store (for testing)
|
||||
*/
|
||||
public async wipe(): Promise<void> {
|
||||
this.certs.clear();
|
||||
// reset interest map
|
||||
this.interestMap = new plugins.lik.InterestMap((domain) => domain);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,4 +95,13 @@ export class MongoCertManager implements ICertManager {
|
||||
public async close(): Promise<void> {
|
||||
await this.db.close();
|
||||
}
|
||||
/**
|
||||
* Wipe all certificates from the persistent store (for integration testing)
|
||||
*/
|
||||
public async wipe(): Promise<void> {
|
||||
// clear all keys in the easy store
|
||||
await this.store.wipe();
|
||||
// reset interest map
|
||||
this.interestMap = new plugins.lik.InterestMap((domain) => domain);
|
||||
}
|
||||
}
|
@ -34,4 +34,8 @@ export interface ICertManager {
|
||||
* Close the store (e.g., disconnect database).
|
||||
*/
|
||||
close(): Promise<void>;
|
||||
/**
|
||||
* Optional: wipe all stored certificates (e.g., for integration testing)
|
||||
*/
|
||||
wipe?(): Promise<void>;
|
||||
}
|
@ -116,6 +116,11 @@ export class SmartAcme {
|
||||
}
|
||||
this.certmanager = this.options.certManager;
|
||||
await this.certmanager.init();
|
||||
// For integration environment, clear any existing certificates to avoid stale entries
|
||||
if (this.options.environment === 'integration' && typeof (this.certmanager as any).wipe === 'function') {
|
||||
// this.logger.log('warn', 'Wiping existing certificates for integration environment');
|
||||
// await (this.certmanager as any).wipe();
|
||||
}
|
||||
|
||||
// CertMatcher
|
||||
this.certmatcher = new SmartacmeCertMatcher();
|
||||
|
Reference in New Issue
Block a user