mirror of
https://github.com/certd/certd.git
synced 2026-04-14 20:40:53 +08:00
perf: 触发证书重新申请input变化对比规则优化,减少升级版本后触发申请证书的情况
This commit is contained in:
@@ -5,6 +5,7 @@ import { CertReader } from "./cert-reader.js";
|
||||
import JSZip from "jszip";
|
||||
import { CertConverter } from "./convert.js";
|
||||
import fs from "fs";
|
||||
import { pick } from "lodash-es";
|
||||
|
||||
export { CertReader };
|
||||
export type { CertInfo };
|
||||
@@ -203,10 +204,35 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
|
||||
return null;
|
||||
}
|
||||
|
||||
const inputChanged = this.ctx.inputChanged;
|
||||
let inputChanged = this.ctx.inputChanged;
|
||||
if (inputChanged) {
|
||||
this.logger.info("输入参数变更,准备申请新证书");
|
||||
return null;
|
||||
this.logger.info("input hash 有变更,检查是否需要重新申请证书");
|
||||
//判断域名有没有变更
|
||||
/**
|
||||
* "renewDays": 20,
|
||||
* "certApplyPlugin": "CertApply",
|
||||
* "sslProvider": "letsencrypt",
|
||||
* "privateKeyType": "rsa_2048_pkcs1",
|
||||
* "dnsProviderType": "aliyun",
|
||||
* "domains": [
|
||||
* "*.handsfree.work"
|
||||
* ],
|
||||
* "email": "xiaojunnuo@qq.com",
|
||||
* "dnsProviderAccess": 3,
|
||||
* "useProxy": false,
|
||||
* "skipLocalVerify": false,
|
||||
* "successNotify": true,
|
||||
* "pfxPassword": "123456"
|
||||
*/
|
||||
const checkInputChanges = ["domains", "sslProvider", "privateKeyType", "dnsProviderType", "dnsProviderAccess", "pfxPassword"];
|
||||
const oldInput = JSON.stringify(pick(this.lastStatus?.input, checkInputChanges));
|
||||
const thisInput = JSON.stringify(pick(this, checkInputChanges));
|
||||
inputChanged = oldInput !== thisInput;
|
||||
|
||||
if (inputChanged) {
|
||||
this.logger.info("输入参数变更,准备申请新证书");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
let oldCert: CertReader | undefined = undefined;
|
||||
|
||||
Reference in New Issue
Block a user