refactor: huawei

This commit is contained in:
xiaojunnuo
2023-05-09 14:11:01 +08:00
parent f489c59ca3
commit 8c152371a1
6 changed files with 29 additions and 20 deletions
@@ -17,8 +17,8 @@ export class AcmeService {
});
}
async getAccountConfig(email: string) {
return (await this.userContext.get(this.buildAccountKey(email))) || {};
async getAccountConfig(email: string): Promise<any> {
return (await this.userContext.getObj(this.buildAccountKey(email))) || {};
}
buildAccountKey(email: string) {
@@ -26,7 +26,7 @@ export class AcmeService {
}
async saveAccountConfig(email: string, conf: any) {
await this.userContext.set(this.buildAccountKey(email), conf);
await this.userContext.setObj(this.buildAccountKey(email), conf);
}
async getAcmeClient(email: string, isTest = false): Promise<acme.Client> {
@@ -183,9 +183,9 @@ export class CertApplyPlugin implements ITaskPlugin {
}
let inputChanged = false;
const inputCacheKey = "input.cert";
const oldInputStr = await this.pipelineContext.get(inputCacheKey);
await this.pipelineContext.set(inputCacheKey, this.cert);
const inputCacheKey = "input.domains";
const oldInputStr = await this.pipelineContext.getObj(inputCacheKey);
await this.pipelineContext.setObj(inputCacheKey, this.domains);
const oldInput = JSON.stringify(oldInputStr);
const thisInput = JSON.stringify(this.cert);
if (oldInput !== thisInput) {
@@ -276,14 +276,14 @@ export class CertApplyPlugin implements ITaskPlugin {
key: this.formatCert(cert.key),
csr: this.formatCert(cert.csr),
};
await this.pipelineContext.set("cert", newCert);
await this.pipelineContext.setObj("cert", newCert);
await this.pipelineContext.set("cert.crt", newCert.crt);
await this.pipelineContext.set("cert.key", newCert.key);
await this.pipelineContext.set("cert.csr", newCert.csr);
}
async readCurrentCert() {
const cert: any = await this.pipelineContext.get("cert");
const cert: any = await this.pipelineContext.getObj("cert");
if (cert == null) {
return undefined;
}