mirror of https://github.com/certd/certd
pref: 增加又拍云 CDN 部署时的 HTTPS 配置选项
- 在插件中添加了两个新的配置项:强制 HTTPS 和开启 HTTPS- 用户可以在部署证书时选择是否强制 HTTPS 或开启 HTTPS -根据用户选择,插件会相应地设置 CDN 域名的 HTTPS 配置pull/373/head
parent
f80b706fc3
commit
37f160a452
|
@ -51,6 +51,7 @@ export class UpyunDeployToCdn extends AbstractPlusTaskPlugin {
|
||||||
accessId!: string;
|
accessId!: string;
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@TaskInput(
|
@TaskInput(
|
||||||
createRemoteSelectInputDefine({
|
createRemoteSelectInputDefine({
|
||||||
title: "加速域名",
|
title: "加速域名",
|
||||||
|
@ -62,6 +63,38 @@ export class UpyunDeployToCdn extends AbstractPlusTaskPlugin {
|
||||||
)
|
)
|
||||||
cdnList!: string[];
|
cdnList!: string[];
|
||||||
|
|
||||||
|
@TaskInput({
|
||||||
|
title: "强制HTTPS",
|
||||||
|
value:"keep",
|
||||||
|
component: {
|
||||||
|
name: "a-select",
|
||||||
|
vModel:"value",
|
||||||
|
options:[
|
||||||
|
{value:"true","label":"强制HTTPS"},
|
||||||
|
{value:"false","label":"不强制HTTPS"},
|
||||||
|
{value:"keep","label":"保持原样"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
required: true //必填
|
||||||
|
})
|
||||||
|
forceHttps!: string;
|
||||||
|
|
||||||
|
@TaskInput({
|
||||||
|
title: "开启HTTPS",
|
||||||
|
value:"true",
|
||||||
|
component: {
|
||||||
|
name: "a-select",
|
||||||
|
vModel:"value",
|
||||||
|
options:[
|
||||||
|
{value:"true","label":"开启HTTPS"},
|
||||||
|
{value:"false","label":"关闭HTTPS"},
|
||||||
|
{value:"keep","label":"保持原样"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
required: true //必填
|
||||||
|
})
|
||||||
|
https!: string;
|
||||||
|
|
||||||
//插件实例化时执行的方法
|
//插件实例化时执行的方法
|
||||||
async onInstance() {
|
async onInstance() {
|
||||||
}
|
}
|
||||||
|
@ -80,15 +113,24 @@ export class UpyunDeployToCdn extends AbstractPlusTaskPlugin {
|
||||||
const certId = await upyunClient.uploadCert(cookie, this.cert);
|
const certId = await upyunClient.uploadCert(cookie, this.cert);
|
||||||
this.logger.info(`上传证书成功:${certId}`);
|
this.logger.info(`上传证书成功:${certId}`);
|
||||||
for (const item of this.cdnList) {
|
for (const item of this.cdnList) {
|
||||||
|
|
||||||
|
const data :any= {
|
||||||
|
crt_id: certId,
|
||||||
|
domain_name: item,
|
||||||
|
}
|
||||||
|
if (this.forceHttps !== 'keep') {
|
||||||
|
data.force_https = Boolean(this.forceHttps);
|
||||||
|
}
|
||||||
|
if (this.https !=='keep') {
|
||||||
|
data.https = Boolean(this.https);
|
||||||
|
}
|
||||||
|
|
||||||
this.logger.info(`开始部署证书:${item}`);
|
this.logger.info(`开始部署证书:${item}`);
|
||||||
const res = await upyunClient.doRequest({
|
const res = await upyunClient.doRequest({
|
||||||
cookie: cookie,
|
cookie: cookie,
|
||||||
url: "https://console.upyun.com/api/https/migrate/domain",
|
url: "https://console.upyun.com/api/https/migrate/domain",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: data
|
||||||
crt_id: certId,
|
|
||||||
domain_name: item
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.logger.info(`部署成功:${JSON.stringify(res)}`);
|
this.logger.info(`部署成功:${JSON.stringify(res)}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue