mirror of
https://github.com/certd/certd.git
synced 2026-07-06 20:37:34 +08:00
fix: 修复西部数码使用域名级别的key申请证书失败的问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
|
||||
import { WestDnsProviderDomain } from './dns-provider-domain.js';
|
||||
import { WestAccess } from './access.js';
|
||||
|
||||
type westRecord = {
|
||||
@@ -31,10 +31,26 @@ export class WestDnsProvider extends AbstractDnsProvider<westRecord> {
|
||||
//...
|
||||
}
|
||||
|
||||
getDomainProvider(){
|
||||
const provider = new WestDnsProviderDomain();
|
||||
provider.access = this.access;
|
||||
provider.logger = this.logger;
|
||||
provider.ctx = this.ctx;
|
||||
provider.http = this.http;
|
||||
return provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建dns解析记录,用于验证域名所有权
|
||||
*/
|
||||
async createRecord(options: CreateRecordOptions): Promise<any> {
|
||||
|
||||
if(this.access.scope === 'domain'){
|
||||
//如果是域名级别的,走老接口
|
||||
const provider = this.getDomainProvider();
|
||||
return provider.createRecord(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* options 参数说明
|
||||
* fullRecord: '_acme-challenge.example.com',
|
||||
@@ -77,6 +93,12 @@ export class WestDnsProvider extends AbstractDnsProvider<westRecord> {
|
||||
* @param options
|
||||
*/
|
||||
async removeRecord(options: RemoveRecordOptions<westRecord>): Promise<void> {
|
||||
if(this.access.scope === 'domain'){
|
||||
//如果是域名级别的,走老接口
|
||||
const provider = this.getDomainProvider();
|
||||
return provider.removeRecord(options as any);
|
||||
}
|
||||
|
||||
const { fullRecord, value, domain } = options.recordReq;
|
||||
const record = options.recordRes;
|
||||
this.logger.info('删除域名解析:', fullRecord, value, record);
|
||||
|
||||
Reference in New Issue
Block a user