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