perf: 优化插件开发,dnsProvider无需写http logger 变量

This commit is contained in:
xiaojunnuo
2024-11-20 11:36:39 +08:00
parent 7c5166c8bb
commit fcbb5e46a1
17 changed files with 29 additions and 69 deletions

View File

@@ -2,12 +2,17 @@ import { CreateRecordOptions, DnsProviderContext, DnsProviderDefine, IDnsProvide
import psl from "psl";
import { dnsProviderRegistry } from "./registry.js";
import { Decorator } from "@certd/pipeline";
import { HttpClient, ILogger } from "@certd/basic";
export abstract class AbstractDnsProvider<T = any> implements IDnsProvider<T> {
ctx!: DnsProviderContext;
http!: HttpClient;
logger!: ILogger;
setCtx(ctx: DnsProviderContext) {
this.ctx = ctx;
this.logger = ctx.logger;
this.http = ctx.http;
}
abstract createRecord(options: CreateRecordOptions): Promise<T>;

View File

@@ -92,7 +92,6 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
csrInfo!: string;
userContext!: IContext;
http!: HttpClient;
lastStatus!: Step;
@TaskOutput({
@@ -102,7 +101,6 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
async onInstance() {
this.userContext = this.ctx.userContext;
this.http = this.ctx.http;
this.lastStatus = this.ctx.lastStatus as Step;
await this.onInit();
}

View File

@@ -96,7 +96,6 @@ export class CertApplyLegoPlugin extends CertApplyBasePlugin {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
this.userContext = this.ctx.userContext;
this.http = this.ctx.http;
this.lastStatus = this.ctx.lastStatus as Step;
if (this.legoEabAccessId) {
this.eab = await this.accessService.getById(this.legoEabAccessId);