mirror of https://github.com/certd/certd
refactor: 小修改
parent
8cc80deff8
commit
c0c2cb328c
|
@ -79,7 +79,7 @@ export class Certd {
|
|||
|
||||
async doCertApply () {
|
||||
const options = this.options
|
||||
const dnsProvider = await this.createDnsProvider(options)
|
||||
const dnsProvider = this.createDnsProvider(options)
|
||||
const cert = await this.acme.order({
|
||||
email: options.cert.email,
|
||||
domains: options.cert.domains,
|
||||
|
@ -94,10 +94,10 @@ export class Certd {
|
|||
return certRet
|
||||
}
|
||||
|
||||
async createDnsProvider (options) {
|
||||
createDnsProvider (options) {
|
||||
const accessProviders = options.accessProviders
|
||||
const providerOptions = accessProviders[options.cert.dnsProvider]
|
||||
return await DnsProviderFactory.createByType(providerOptions.providerType, providerOptions)
|
||||
return DnsProviderFactory.createByType(providerOptions.providerType, providerOptions)
|
||||
}
|
||||
|
||||
async writeCert (cert) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import dnsProviders from './index.js'
|
||||
|
||||
export class DnsProviderFactory {
|
||||
static async createByType (type, options) {
|
||||
static createByType (type, options) {
|
||||
try {
|
||||
const Provider = dnsProviders[type]
|
||||
return new Provider(options)
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
import dnsProviders from './dns-provider/index.js'
|
||||
export { DnsProviderFactory } from './dns-provider/dns-provider-factory.js'
|
||||
|
||||
export default dnsProviders
|
||||
|
|
Loading…
Reference in New Issue