mirror of
https://github.com/certd/certd.git
synced 2026-07-10 23:27:34 +08:00
feat: 腾讯云cdn支持
This commit is contained in:
@@ -20,7 +20,7 @@ export class DeployCertToAliyunCDN extends AbstractAliyunPlugin {
|
||||
certName: {
|
||||
label: '证书名称'
|
||||
},
|
||||
certType: {
|
||||
from: {
|
||||
value: 'upload',
|
||||
label: '证书来源',
|
||||
options: [
|
||||
@@ -51,10 +51,10 @@ export class DeployCertToAliyunCDN extends AbstractAliyunPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
async execute ({ accessProviders, cert, args, context }) {
|
||||
const accessProvider = this.getAccessProvider(args.accessProvider, accessProviders)
|
||||
async execute ({ accessProviders, cert, props, context }) {
|
||||
const accessProvider = this.getAccessProvider(props.accessProvider, accessProviders)
|
||||
const client = this.getClient(accessProvider)
|
||||
const params = this.buildParams(args, context, cert)
|
||||
const params = this.buildParams(props, context, cert)
|
||||
await this.doRequest(client, params)
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export class DeployCertToAliyunCDN extends AbstractAliyunPlugin {
|
||||
}
|
||||
|
||||
buildParams (args, context, cert) {
|
||||
const { certName, certType, domainName } = args
|
||||
const { certName, from, domainName } = args
|
||||
const CertName = certName + '-' + dayjs().format('YYYYMMDDHHmmss')
|
||||
|
||||
const params = {
|
||||
@@ -76,7 +76,7 @@ export class DeployCertToAliyunCDN extends AbstractAliyunPlugin {
|
||||
DomainName: domainName,
|
||||
ServerCertificateStatus: 'on',
|
||||
CertName: CertName,
|
||||
CertType: certType,
|
||||
CertType: from,
|
||||
ServerCertificate: super.format(cert.crt.toString()),
|
||||
PrivateKey: super.format(cert.key.toString())
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ export class UploadCertToAliyun extends AbstractAliyunPlugin {
|
||||
})
|
||||
}
|
||||
|
||||
async execute ({ accessProviders, cert, args, context, logger }) {
|
||||
const { name, accessProvider } = args
|
||||
const certName = name + '-' + dayjs().format('YYYYMMDDHHmmss')
|
||||
async execute ({ accessProviders, cert, props, context, logger }) {
|
||||
const { name, accessProvider } = props
|
||||
const certName = name + '-' + dayjs().format('YYYYMMDD-HHmmss')
|
||||
const params = {
|
||||
RegionId: 'cn-hangzhou',
|
||||
Name: certName,
|
||||
@@ -59,7 +59,7 @@ export class UploadCertToAliyun extends AbstractAliyunPlugin {
|
||||
const client = this.getClient(provider)
|
||||
const ret = await client.request('CreateUserCertificate', params, requestOption)
|
||||
this.checkRet(ret)
|
||||
this.logger.info('证书上传成功:certId=', ret.CertId)
|
||||
this.logger.info('证书上传成功:aliyunCertId=', ret.CertId)
|
||||
context.aliyunCertId = ret.CertId
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user