mirror of
https://github.com/certd/certd.git
synced 2026-04-03 14:10:54 +08:00
fix: 优化dcdn部署上传多次证书 偶尔报 The CertName already exists的问题
This commit is contained in:
@@ -79,9 +79,11 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
|
|||||||
if (typeof this.domainName === 'string') {
|
if (typeof this.domainName === 'string') {
|
||||||
this.domainName = [this.domainName];
|
this.domainName = [this.domainName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const params:any = await this.buildParams();
|
||||||
for (const domainName of this.domainName) {
|
for (const domainName of this.domainName) {
|
||||||
this.logger.info(`[${domainName}]开始部署`)
|
this.logger.info(`[${domainName}]开始部署`)
|
||||||
const params = await this.buildParams(domainName);
|
params.DomainName = domainName;
|
||||||
await this.doRequest(client, params);
|
await this.doRequest(client, params);
|
||||||
this.logger.info(`[${domainName}]部署成功`)
|
this.logger.info(`[${domainName}]部署成功`)
|
||||||
}
|
}
|
||||||
@@ -100,7 +102,7 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
async buildParams(domainName: string) {
|
async buildParams() {
|
||||||
const CertName = (this.certName ?? 'certd') + '-' + dayjs().format('YYYYMMDDHHmmss');
|
const CertName = (this.certName ?? 'certd') + '-' + dayjs().format('YYYYMMDDHHmmss');
|
||||||
|
|
||||||
let certId: any = this.cert
|
let certId: any = this.cert
|
||||||
@@ -111,7 +113,6 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
|
|||||||
this.logger.info('上传证书:', CertName);
|
this.logger.info('上传证书:', CertName);
|
||||||
const cert: any = this.cert;
|
const cert: any = this.cert;
|
||||||
return {
|
return {
|
||||||
DomainName: domainName,
|
|
||||||
SSLProtocol: 'on',
|
SSLProtocol: 'on',
|
||||||
CertName: CertName,
|
CertName: CertName,
|
||||||
CertType: 'upload',
|
CertType: 'upload',
|
||||||
@@ -126,7 +127,6 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
|
|||||||
}
|
}
|
||||||
this.logger.info('使用已上传的证书:', certId);
|
this.logger.info('使用已上传的证书:', certId);
|
||||||
return {
|
return {
|
||||||
DomainName: domainName,
|
|
||||||
SSLProtocol: 'on',
|
SSLProtocol: 'on',
|
||||||
CertType: 'cas',
|
CertType: 'cas',
|
||||||
CertName: CertName,
|
CertName: CertName,
|
||||||
|
|||||||
Reference in New Issue
Block a user