feat: 腾讯云证书clb支持与删除

This commit is contained in:
xiaojunnuo
2020-12-28 00:22:12 +08:00
parent 25dae3d1ec
commit 43e90503ca
10 changed files with 365 additions and 49 deletions

View File

@@ -1,17 +1,26 @@
import fs from 'fs'
import logger from '../utils/util.log.js'
import dayjs from 'dayjs'
import Sleep from '../utils/util.sleep.js'
export class AbstractPlugin {
constructor () {
this.logger = logger
}
appendTimeSuffix (name) {
if (name == null) {
name = 'certd'
}
return name + '-' + dayjs().format('YYYYMMDD-HHmmss')
}
async executeFromContextFile (options = {}) {
const { contextPath } = options
const contextJson = fs.readFileSync(contextPath)
const context = JSON.parse(contextJson)
options.context = context
const newContext = await this.execute(options)
fs.writeFileSync(JSON.stringify(newContext || context))
await this.doExecute(options)
fs.writeFileSync(JSON.stringify(context))
}
async doExecute (options) {
@@ -55,4 +64,8 @@ export class AbstractPlugin {
}
return accessProvider
}
async sleep (time) {
await Sleep(time)
}
}