mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-05 05:54:53 +00:00
Merge branch 'next' into feat/new-workflow-ui
This commit is contained in:
@@ -39,6 +39,7 @@ const (
|
||||
configTypeCloudflare = "cloudflare"
|
||||
configTypeGoDaddy = "godaddy"
|
||||
configTypeHuaweiCloud = "huaweicloud"
|
||||
configTypeNameDotCom = "namedotcom"
|
||||
configTypeNameSilo = "namesilo"
|
||||
configTypePowerDNS = "powerdns"
|
||||
configTypeTencentCloud = "tencentcloud"
|
||||
@@ -225,6 +226,8 @@ func GetWithTypeOption(t string, option *ApplyOption) (Applicant, error) {
|
||||
return NewGoDaddyApplicant(option), nil
|
||||
case configTypeHuaweiCloud:
|
||||
return NewHuaweiCloudApplicant(option), nil
|
||||
case configTypeNameDotCom:
|
||||
return NewNameDotComApplicant(option), nil
|
||||
case configTypeNameSilo:
|
||||
return NewNamesiloApplicant(option), nil
|
||||
case configTypePowerDNS:
|
||||
|
38
internal/applicant/namedotcom.go
Normal file
38
internal/applicant/namedotcom.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package applicant
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v4/providers/dns/namedotcom"
|
||||
"github.com/usual2970/certimate/internal/domain"
|
||||
)
|
||||
|
||||
type nameDotComApplicant struct {
|
||||
option *ApplyOption
|
||||
}
|
||||
|
||||
func NewNameDotComApplicant(option *ApplyOption) Applicant {
|
||||
return &nameDotComApplicant{
|
||||
option: option,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *nameDotComApplicant) Apply() (*Certificate, error) {
|
||||
access := &domain.NameDotComAccess{}
|
||||
json.Unmarshal([]byte(a.option.Access), access)
|
||||
|
||||
config := namedotcom.NewDefaultConfig()
|
||||
config.Username = access.Username
|
||||
config.APIToken = access.ApiToken
|
||||
if a.option.Timeout != 0 {
|
||||
config.PropagationTimeout = time.Duration(a.option.Timeout) * time.Second
|
||||
}
|
||||
|
||||
provider, err := namedotcom.NewDNSProviderConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return apply(a.option, provider)
|
||||
}
|
@@ -77,6 +77,11 @@ type GodaddyAccess struct {
|
||||
ApiSecret string `json:"apiSecret"`
|
||||
}
|
||||
|
||||
type NameDotComAccess struct {
|
||||
Username string `json:"username"`
|
||||
ApiToken string `json:"apiToken"`
|
||||
}
|
||||
|
||||
type PdnsAccess struct {
|
||||
ApiUrl string `json:"apiUrl"`
|
||||
ApiKey string `json:"apiKey"`
|
||||
|
Reference in New Issue
Block a user