mirror of https://github.com/certd/certd
fix: 修复阿里云cdn证书部署失败问题,增加certname参数传入
- 添加证书所在地域选择功能,默认为 cn-hangzhou(杭州) - 国际站用户可选择 ap-southeast-1(新加坡)地域 - 优化证书上传和设置流程,增加证书名称和地域参数pull/373/head
parent
9c4cbe17a2
commit
965dc2cb47
|
@ -68,12 +68,29 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
|||
)
|
||||
domainName!: string | string[];
|
||||
|
||||
@TaskInput({
|
||||
title: '证书所在地域',
|
||||
helper: 'cn-hangzhou和ap-southeast-1,默认cn-hangzhou。国际站用户建议使用ap-southeast-1。',
|
||||
value:"cn-hangzhou",
|
||||
component: {
|
||||
name: 'a-select',
|
||||
options:[
|
||||
{value:'cn-hangzhou',label:'中国大陆'},
|
||||
{value:'ap-southeast-1',label:'新加坡'}
|
||||
]
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
certRegion:string
|
||||
|
||||
@TaskInput({
|
||||
title: '证书名称',
|
||||
helper: '上传后将以此名称作为前缀备注',
|
||||
})
|
||||
certName!: string;
|
||||
|
||||
|
||||
|
||||
async onInstance() {}
|
||||
async execute(): Promise<void> {
|
||||
this.logger.info('开始部署证书到阿里云cdn');
|
||||
|
@ -89,9 +106,12 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
|||
}
|
||||
|
||||
let certId: any = this.cert;
|
||||
|
||||
const certName = this.appendTimeSuffix(this.certName);
|
||||
|
||||
if (typeof this.cert === 'object') {
|
||||
certId = await sslClient.uploadCert({
|
||||
name: this.appendTimeSuffix(this.certName),
|
||||
name:certName,
|
||||
cert: this.cert,
|
||||
});
|
||||
}
|
||||
|
@ -105,6 +125,8 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
|||
await this.SetCdnDomainSSLCertificate(client, {
|
||||
CertId: certId,
|
||||
DomainName: domain,
|
||||
CertName: certName,
|
||||
CertRegion:this.certRegion || 'cn-hangzhou',
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -122,7 +144,7 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
|||
return client;
|
||||
}
|
||||
|
||||
async SetCdnDomainSSLCertificate(client: any, params: { CertId: number; DomainName: string }) {
|
||||
async SetCdnDomainSSLCertificate(client: any, params: { CertId: number; DomainName: string,CertName:string,CertRegion:string }) {
|
||||
const requestOption = {
|
||||
method: 'POST',
|
||||
formatParams: false,
|
||||
|
|
Loading…
Reference in New Issue