perf: 关闭腾讯云证书通知提醒

pull/409/head
xiaojunnuo 2025-05-27 00:10:50 +08:00
parent 378c777a38
commit 231a875bb4
2 changed files with 20 additions and 18 deletions

View File

@ -49,7 +49,7 @@ export class TencentSslClient {
}; };
const ret = await client.UploadCertificate(params); const ret = await client.UploadCertificate(params);
this.checkRet(ret); this.checkRet(ret);
this.logger.info("证书上传成功tencentCertId=", ret.CertificateId); this.logger.info(`证书[${opts.certName}]上传成功tencentCertId=`, ret.CertificateId);
await this.switchCertNotify([ret.CertificateId], true); await this.switchCertNotify([ret.CertificateId], true);
return ret.CertificateId; return ret.CertificateId;
} }

View File

@ -1,6 +1,8 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline'; import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from "@certd/pipeline";
import dayjs from 'dayjs'; import dayjs from "dayjs";
import { CertApplyPluginNames} from '@certd/plugin-cert'; import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert";
import { TencentAccess, TencentSslClient } from "@certd/plugin-lib";
@IsTaskPlugin({ @IsTaskPlugin({
name: 'UploadCertToTencent', name: 'UploadCertToTencent',
title: '腾讯云-上传证书到腾讯云', title: '腾讯云-上传证书到腾讯云',
@ -14,8 +16,8 @@ import { CertApplyPluginNames} from '@certd/plugin-cert';
}, },
}) })
export class UploadCertToTencent extends AbstractTaskPlugin { export class UploadCertToTencent extends AbstractTaskPlugin {
@TaskInput({ title: '证书名称' }) // @TaskInput({ title: '证书名称' })
name!: string; // name!: string;
@TaskInput({ @TaskInput({
title: 'Access授权', title: 'Access授权',
@ -51,19 +53,19 @@ export class UploadCertToTencent extends AbstractTaskPlugin {
} }
async execute(): Promise<void> { async execute(): Promise<void> {
const { accessId, name, cert } = this; const access = await this.getAccess<TencentAccess>(this.accessId);
const accessProvider = await this.getAccess(accessId); const sslClient = new TencentSslClient({
const certName = this.appendTimeSuffix(name || cert.domain); access,
const client = this.getClient(accessProvider); logger: this.logger,
});
const params = { const certReader = new CertReader(this.cert);
CertificatePublicKey: cert.crt, const tencentCertId = await sslClient.uploadToTencent({
CertificatePrivateKey: cert.key, certName: certReader.buildCertName(),
Alias: certName, cert: this.cert,
}; });
const ret = await client.UploadCertificate(params);
this.checkRet(ret); this.logger.info('证书上传成功tencentCertId=', tencentCertId);
this.logger.info('证书上传成功tencentCertId=', ret.CertificateId);
this.tencentCertId = ret.CertificateId; this.tencentCertId = ret.CertificateId;
} }