mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
feat: 腾讯云cdn支持
This commit is contained in:
@@ -8,14 +8,11 @@ describe('DeployToAliyunCDN', function () {
|
||||
const plugin = new DeployCertToAliyunCDN()
|
||||
const certd = new Certd()
|
||||
const cert = certd.readCurrentCert('xiaojunnuo@qq.com', ['*.docmirror.cn'])
|
||||
const ret = await plugin.execute({
|
||||
const ret = await plugin.doExecute({
|
||||
accessProviders: options.accessProviders,
|
||||
cert,
|
||||
args: { domainName: 'certd-cdn-upload.docmirror.cn', certName: 'certd部署测试', certType: 'cas', accessProvider: 'aliyun' },
|
||||
context: {
|
||||
aliyunCertId: '4947435'
|
||||
}
|
||||
props: { domainName: 'certd-cdn-upload.docmirror.cn', certName: 'certd部署测试', certType: 'cas', accessProvider: 'aliyun' }
|
||||
})
|
||||
console.log('context:', context)
|
||||
console.log('context:', context, ret)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -9,11 +9,11 @@ describe('PluginUploadToAliyun', function () {
|
||||
const certd = new Certd()
|
||||
const cert = certd.readCurrentCert('xiaojunnuo@qq.com', ['_.docmirror.cn'])
|
||||
const context = {}
|
||||
await plugin.execute({
|
||||
await plugin.doExecute({
|
||||
accessProviders: options.accessProviders,
|
||||
cert,
|
||||
context,
|
||||
args: { name: 'certd部署测试', provider: 'aliyun' }
|
||||
props: { name: 'certd部署测试', accessProvider: 'aliyun' },
|
||||
context
|
||||
})
|
||||
|
||||
console.log('context:', context)
|
||||
|
||||
@@ -2,6 +2,10 @@ import _ from 'lodash'
|
||||
import optionsPrivate from '../../../test/options.private.mjs'
|
||||
const defaultOptions = {
|
||||
version: '1.0.0',
|
||||
args: {
|
||||
directory: 'test',
|
||||
dry: false
|
||||
},
|
||||
accessProviders: {
|
||||
aliyun: {
|
||||
providerType: 'aliyun',
|
||||
@@ -20,10 +24,8 @@ const defaultOptions = {
|
||||
cert: {
|
||||
domains: ['*.docmirror.club', 'docmirror.club'],
|
||||
email: 'xiaojunnuo@qq.com',
|
||||
challenge: {
|
||||
challengeType: 'dns',
|
||||
dnsProvider: 'aliyun'
|
||||
},
|
||||
dnsProvider: 'aliyun',
|
||||
certProvider: 'letsencrypt',
|
||||
csrInfo: {
|
||||
country: 'CN',
|
||||
state: 'GuangDong',
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import pkg from 'chai'
|
||||
import { DeployCertToTencentCDN } from '../../src/tencent/deploy-to-cdn/index.js'
|
||||
import { Certd } from '@certd/certd'
|
||||
import { UploadCertToTencent } from '../../src/tencent/upload-to-tencent/index.js'
|
||||
import { createOptions } from '../../../../test/options.js'
|
||||
const { expect } = pkg
|
||||
describe('DeployToTencentCDN', function () {
|
||||
it('#execute-from-store', async function () {
|
||||
const options = createOptions()
|
||||
options.args.test = false
|
||||
const certd = new Certd(options)
|
||||
const cert = certd.readCurrentCert('xiaojunnuo@qq.com', ['*.docmirror.cn'])
|
||||
const context = {}
|
||||
const uploadPlugin = new UploadCertToTencent()
|
||||
const uploadOptions = {
|
||||
accessProviders: options.accessProviders,
|
||||
cert,
|
||||
props: { name: 'certd部署测试', accessProvider: 'tencent' },
|
||||
context
|
||||
}
|
||||
await uploadPlugin.doExecute(uploadOptions)
|
||||
|
||||
const deployPlugin = new DeployCertToTencentCDN()
|
||||
const deployOpts = {
|
||||
accessProviders: options.accessProviders,
|
||||
cert,
|
||||
props: { domainName: 'tentcent-certd.docmirror.cn', certName: 'certd部署测试', accessProvider: 'tencent' },
|
||||
context
|
||||
}
|
||||
const ret = await deployPlugin.doExecute(deployOpts)
|
||||
expect(ret).ok
|
||||
console.log('context:', context)
|
||||
|
||||
await uploadPlugin.doRollback(uploadOptions)
|
||||
})
|
||||
it('#execute-upload', async function () {
|
||||
const options = createOptions()
|
||||
options.args.test = false
|
||||
const plugin = new DeployCertToTencentCDN()
|
||||
const certd = new Certd()
|
||||
const cert = certd.readCurrentCert('xiaojunnuo@qq.com', ['*.docmirror.cn'])
|
||||
const context = {}
|
||||
const deployOpts = {
|
||||
accessProviders: options.accessProviders,
|
||||
cert,
|
||||
props: { domainName: 'tentcent-certd.docmirror.cn', from: 'upload', accessProvider: 'tencent' },
|
||||
context
|
||||
}
|
||||
const ret = await plugin.doExecute(deployOpts)
|
||||
console.log('context:', context, ret)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,25 @@
|
||||
import pkg from 'chai'
|
||||
import { UploadCertToTencent } from '../../src/tencent/upload-to-tencent/index.js'
|
||||
import { Certd } from '@certd/certd'
|
||||
import { createOptions } from '../../../../test/options.js'
|
||||
const { expect } = pkg
|
||||
describe('PluginUploadToTencent', function () {
|
||||
it('#execute', async function () {
|
||||
const options = createOptions()
|
||||
const plugin = new UploadCertToTencent()
|
||||
options.args = { test: false }
|
||||
const certd = new Certd(options)
|
||||
const cert = certd.readCurrentCert('xiaojunnuo@qq.com', ['*.docmirror.cn'])
|
||||
const context = {}
|
||||
const uploadOpts = {
|
||||
accessProviders: options.accessProviders,
|
||||
cert,
|
||||
props: { name: 'certd部署测试', accessProvider: 'tencent' },
|
||||
context
|
||||
}
|
||||
await plugin.doExecute(uploadOpts)
|
||||
console.log('context:', context)
|
||||
|
||||
await plugin.doRollback(uploadOpts)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user